File generation method and device, equipment and storage medium
By entering the first type of files into a large-scale first model, generating the second type of files corresponding to it, and using these files to adjust the second model, the training sample generation cost in the prior art is solved, which has high training sample generation, insufficient scale and diversity in size, and inadequate training sample generation in the prior art. Problem, efficient and diverse training sample generation is achieved.
Patent Information
- Application Number
- CN202410936185.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-15
AI Technical Summary
The prior art requires manual annotation when generating training samples of neural network models. It is costly and has limited scale and diversity, making it difficult to meet the needs of large-scale high-quality training samples.
By entering the first type of file into a large-scale first model, generate the second type of file corresponding to it, and use these file pairs to adjust the second model, generate more second type files as training samples, avoid manual annotation, and reduce the cost and increase the number and diversity of generated files.
It achieves cost savings, improves the number and diversity of training samples, can cover various fields and situations, and effectively solves the quality and scale problems of training sample generation.
Smart Images

Figure CN118964545A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to the technical fields of artificial intelligence, neural network models, large language models, etc. Background Art
[0002] Before applying a neural network model, it is often necessary to use large-scale, high-quality training samples for training. The quality and scale of the training samples are crucial to the performance and application effect of the neural network model. Summary of the invention
[0003] The present disclosure provides a file generation method, apparatus, device and storage medium.
[0004] According to one aspect of the present disclosure, there is provided a file generation method, comprising:
[0005] Input M1 first-type files into the first model respectively, and the first model outputs second-type files corresponding to each first-type file;
[0006] Determine a plurality of file pairs according to the output result, each file pair comprising a first type file and a second type file corresponding to the first type file;
[0007] Using the plurality of file pairs, adjusting the second model; and,
[0008] M2 first-type files are respectively input into the adjusted second model, and the adjusted second model outputs second-type files corresponding to each first-type file; M1 and M2 are positive integers.
[0009] A file generating device, comprising:
[0010] A first input module, used to input M1 first-type files into a first model respectively, and the first model outputs a second-type file corresponding to each first-type file;
[0011] A determination module, used to determine a plurality of file pairs according to the output result, each file pair comprising a first type file and a second type file corresponding to the first type file;
[0012] an adjustment module, configured to adjust the second model using a plurality of file pairs; and
[0013] The second input module is used to input M2 first type files into the adjusted second model respectively, and the adjusted second model outputs the second type files corresponding to each first type file; M1 and M2 are positive integers.
[0014] According to another aspect of the present disclosure, there is provided an electronic device, comprising:
[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 execute any method in the embodiments of the present disclosure.
[0018] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any method according to the embodiments of the present disclosure.
[0019] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, which implements any method according to the embodiments of the present disclosure when executed by a processor.
[0020] The present disclosure proposes a file generation method, and the files generated by this method can be used as training samples for a neural network model. Specifically, a first model is used to generate multiple file pairs, each file pair includes a first type of file and a second type of file corresponding to the first type of file; and the second model is adjusted using these file pairs; then, the adjusted second model is used to generate multiple corresponding second type files based on multiple first type files; the second type of files can be used as training samples for other neural network models. In this way, the training samples generated by the first model can be used to train the second model, and then the trained second model can be used to generate training samples for other neural network models, thereby proposing a new training sample generation scheme, which can avoid manual labeling, thereby saving costs; and can use the generation capability of the first model, and the generated files can cover various fields and situations, thereby increasing the number and diversity of generated files.
[0021] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0023] Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present disclosure;
[0024] Figure 2 is a flowchart of a method for generating a file according to an embodiment of the present disclosure;
[0025] Figure 3 is a schematic diagram of the first stage of a file generation method according to an embodiment of the present disclosure;
[0026] Figure 4 is a schematic diagram of the second stage of the file generation method according to an embodiment of the present disclosure;
[0027] Figure 5 is a schematic diagram of the third stage of the file generation method according to an embodiment of the present disclosure;
[0028] Figure 6 is a structural schematic diagram of a file generating device 600 according to an embodiment of the present disclosure;
[0029] Figure 7 is a schematic block diagram of an example electronic device 700 that may be used to implement embodiments of the present disclosure. DETAILED DESCRIPTION
[0030] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0031] The “and / or” in the embodiments of the present disclosure indicates that three relationships may exist. For example, A and / or B may indicate the following three situations: A exists alone, A and B exist at the same time, and B exists alone. The term “at least one” herein indicates any combination of at least two of any one or more of a plurality of types. For example, at least one of A, B, and C may indicate any one or more elements selected from the set consisting of A, B, and C. The terms “first” and “second” herein refer to and distinguish between multiple similar technical terms, and do not mean to limit the order or to limit the meaning to only two. For example, the first feature and the second feature refer to two types / two features. The first feature may be one or more, and the second feature may also be one or more.
[0032] Before applying neural network models, they often need to be trained with large-scale, high-quality training samples. The quality and scale of training samples are crucial to the performance and application effect of neural network models. Taking the Large Language Model (LLM) as an example, when a large language model is applied to a vertical field, it often needs to be fine-tuned with a large amount of high-quality dialogue corpus (also called dialogue-type corpus, dialogue-level corpus, etc.). The quality and scale of the corpus determine the upper limit of the application of the large language model in the vertical field. The quality of the dialogue corpus refers to the accuracy, consistency and rationality of the expression of the dialogue content in the dialogue corpus, which is crucial to the performance and application effect of the model.
[0033] Accuracy means that the content of the conversation should be based on reliable information sources, verified and reviewed to ensure the authenticity and credibility of the information. Accuracy also includes the understanding and correct application of specific fields and professional terms to avoid misleading or erroneous information transmission.
[0034] Consistency means that the model's answers to the same questions or situations in different conversations remain consistent. This requires the writers or annotators of the dialogue data to have a consistent understanding and standards to ensure the coherence and reliability of the model output.
[0035] The larger the corpus, the richer the model's knowledge reserve and response ability in a specific field. The use of large-scale corpora can help the model better understand and answer questions in a specific field and provide more accurate and comprehensive information.
[0036] It can be seen that the quality and scale of conversational corpora have an important impact on the application of large language models in vertical fields. Only by fine-tuning the model with a large amount of conversational corpus can the model better adapt to the needs of specific fields and provide high-quality, accurate answers and solutions. Therefore, building and maintaining a high-quality and large-scale conversational corpus is crucial to enhancing the application potential of large language models in vertical fields.
[0037] There are many implementation schemes in the prior art to obtain files that can be used as model training samples. The following are some common implementation schemes:
[0038] (1) Manual labeling: This is one of the most common methods currently, where specialized labelers label the files to ensure the accuracy and consistency of the training samples. This method is costly and requires a lot of human resources and time.
[0039] (2) Involvement of experts in vertical fields: Invite experts in vertical fields to participate in the annotation of documents. They can provide domain expertise to ensure the accuracy and rationality of documents used as training samples in the vertical field. This approach can improve the quality of the corpus, but requires close cooperation with experts and reasonable arrangement of their time and resources. This may limit the speed and scale of corpus generation and increase the communication and coordination costs with experts.
[0040] (3) Internal data collection: Utilize data resources within the vertical domain, such as internal conversation records, chat records, etc. These data can be sorted and processed and converted into high-quality training samples. This method can make full use of the knowledge and resources within the domain, but there may be problems with limited data size, and documents in specific fields may not be easy to obtain, especially in emerging fields or fields involving confidential information. This may result in a limited size and diversity of the training sample library.
[0041] (4) Data alignment and transfer learning: Utilize the existing general domain training sample library and transform it into training samples suitable for vertical domains through data alignment and transfer learning techniques. This method can reduce the dependence on new domain corpus, but still requires a certain amount of human participation and domain knowledge.
[0042] It can be seen that the existing methods of generating training samples have problems such as the need for manual labeling, high cost, limited scale and diversity. The above content is explained by taking the generation of training samples for training a large language model as an example. In the prior art, for neural network models with other functions, such as image recognition models, classification models, etc., when generating training samples for training these neural network models, there are also problems such as the need for manual labeling, high cost, limited scale and diversity.
[0043] In order to solve the above problems, the embodiment of the present disclosure proposes a file generation method, and the file generated by this method can be used as a training sample of a neural network model. Figure 1 is a schematic diagram of an application scenario according to an embodiment of the present disclosure, such as Figure 1As shown, the application scenario diagram of the embodiment of the present disclosure may include but is not limited to a file generating device 110 and a model training device 120, and the file generating device 110 and the model training device 120 may communicate with each other through any type of wired or wireless network. Specifically, the file generating device 110 can generate a file that can be used as a training sample for a neural network model, and send the file to the model training device 120; the model training device 120 can be used to receive the file, and use the file to train or fine-tune the neural network model. Among them, the file generating device 110 and the model training device 120 proposed in the embodiment of the present disclosure may include an electronic device or a server. In addition, the embodiment of the present disclosure does not specifically limit the number of file generating devices 110 or model training devices 120. For example, the application scenario diagram of the embodiment of the present disclosure may include one or more file generating devices 110 and / or model training devices 120.
[0044] Figure 2 is a flowchart of a method for generating a file according to an embodiment of the present disclosure, comprising:
[0045] S210, inputting M1 first-type files into a first model respectively, and having the first model output a second-type file corresponding to each first-type file;
[0046] S220, determining a plurality of file pairs according to the output result, each file pair including a first type file and a second type file corresponding to the first type file;
[0047] S230, using the multiple file pairs, adjusting the second model; and,
[0048] S240, inputting M2 first-type files into the adjusted second model respectively, and the adjusted second model outputs second-type files corresponding to each first-type file;
[0049] Among them, M1 and M2 are positive integers.
[0050] In some embodiments, the first model may include an existing large language model for the public. The first model is large in scale and can provide services to a variety of different users. The second model may include an efficient and low-cost language model. The second model is a proprietary model with a smaller scale and lower cost. The second model can be used in specific vertical fields.
[0051] The disclosed embodiment combines a large-scale language model with an efficient and low-cost language model to generate a file, which can be used as a training sample or corpus for other models. This solution can avoid manual labeling, thereby saving costs. In addition, this solution can utilize the generation capability of the large language model, and the generated files can cover various fields and situations, thereby increasing the number and diversity of generated files.
[0052] When using an existing large language model to generate files for use as training samples or corpora, the easiest way to think of is to use the large language model to generate all training samples or corpora. However, since the cost of using a large language model is high, in order to generate a huge number of training samples or corpora, a large language model needs to be used in large quantities, so this method is costly; and during the generation process, data needs to be input into the large language model. Since the large language model provides services to the public, the security of this data cannot be guaranteed.
[0053] The file generation method proposed in the embodiment of the present disclosure adopts the existing large language model and the efficient and low-cost self-owned language model, and inputs some first-type files (such as the M1 first-type files in the above scheme) into the large language model respectively, and the large language model outputs the corresponding M1 second-type files respectively. A first-type file and a corresponding second-type file can constitute a file pair, which constitutes a total of M1 file pairs (for the convenience of description, the data cleaning process is not considered here; if the cleaning process is considered, the number of file pairs is less than M1). Among them, the first-type file can be a file in a specific vertical field, so that the generated M1 file pairs also correspond to the specific vertical field.
[0054] M1 file pairs can be used to adjust the second model. For example, the second model is a pre-trained language model, and the second model is an own model. The disclosed embodiment uses the file pairs generated by the first model to adjust the second model (such as supervised fine-tuning). This adjustment process can enhance the ability of the second model in this specific vertical field. Afterwards, a large number of first-type files (such as M2 first-type files in the above scheme) are respectively input into the adjusted second model, and the large language model outputs corresponding M2 second-type files respectively. The M2 second-type files can be used as training samples or corpora for other models to train the capabilities of other models in this specific vertical field.
[0055] In some embodiments, M2 may be greater than M1, for example, M2 is much greater than M1 (M2>>M1); in this way, a small amount of first-type files may be input to the first model (such as an existing large language model); and the output result of the existing large language model is used to construct a file pair, and the file pair is used to adjust the own language model; then a large amount of first-type files are input to the adjusted own language model, so that the adjusted own language model outputs a large amount of second-type files as training samples or corpus for other models. In this way, the use of the existing large language model can be minimized, thereby reducing costs.
[0056] In some implementations, the M2 first-type files input to the adjusted own language model (i.e., the second model) include files that require security protection, while the M1 first-type files input to the existing large language model (i.e., the first model) may be files with lower security requirements. Therefore, this solution does not need to disclose files that require security protection to the outside world, but can use its own language model for conversion locally, thereby effectively protecting data security.
[0057] It can be seen that the file generation method proposed in the embodiment of the present disclosure can achieve the effects of saving costs and protecting data security at the same time by combining the existing large language model and the original language model.
[0058] The first type of file and the second type of file proposed in the embodiment of the present disclosure can be in various forms, for example, the first type of file is a chapter corpus, and the second type of file is a dialogue corpus; or, the first type of file is a dialogue corpus, and the second type of file is a chapter corpus; or, the first type of file is a text (such as a chapter or a dialogue), and the second type of file is an image, video or cartoon, etc.; or, the first type of file is an image, video or cartoon, etc., and the second type of file is a text (such as a chapter or a dialogue); or, the first type of file is a text (such as a chapter), and the second type of file is an article outline corresponding to the text; or, the first type of file is an article outline, and the second type of file is a text (such as a chapter) corresponding to the outline; etc. The embodiment of the present disclosure does not limit the specific types of the first type of file and the second type of file, and the first model and the second model involved in the embodiment of the present disclosure can also be other types of models, such as a multimodal large language model (MLLM), which can combine information of multiple modalities (such as text, image, video, etc.) to generate and understand richer natural language.
[0059] The following is an introduction to the first type of file, which is the text corpus, and the second type of file, which is the dialogue corpus. Text corpus can include books, articles, blogs, research reports, etc. A text is a well-organized form of language expression, which is a complete article or work formed by organically organizing various sentences and paragraphs through a unified theme and logical relationship. Dialogue corpus includes the content of conversations between two or more people. Dialogue corpus can include multiple dialogue questions and answers to each dialogue question.
[0060] The file generation method proposed in the embodiment of the present disclosure includes the following stages:
[0061] In the first stage, we collect text corpus and convert it into dialogue corpus:
[0062] Figure 3 : This is a schematic diagram of the first stage of the file generation method of an embodiment of the present disclosure. In the first stage, a small amount of chapter corpus (denoted as P in this embodiment) in a specific vertical field is collected. These chapter corpus may include books, blogs, research reports, etc. Using the existing large language model, combined with a specific prompt word (prompt), the chapter corpus P is converted to obtain the corresponding dialogue corpus (denoted as D in this embodiment). Among them, the prompt may contain the content of the chapter corpus P. Through this step, a number of M1 file pairs (or input-output pairs) can be obtained, each file pair includes a chapter corpus and its corresponding dialogue corpus, denoted as (chapter corpus P, dialogue corpus D). The chapter corpus and dialogue corpus in this stage may correspond to a specific vertical field. For example, the chapter corpus in a specific vertical field is collected, and accordingly, the dialogue corpus generated by the existing large language model based on the chapter corpus also corresponds to the specific vertical field.
[0063] In the second stage, fine-tune your own language model:
[0064] Figure 4 This is a schematic diagram of the second stage of the file generation method of an embodiment of the present disclosure. In this stage, the M1 file pairs (or input-output pairs) collected in the first stage are used to perform supervised fine-tuning on the own language model. For example, the back-propagation algorithm is used to fine-tune the own language model. Specifically, the chapter corpus in the file pair is used as a training sample, and the corresponding dialogue corpus is used as the label of the training sample; the training sample is input into the own language model, and the corresponding dialogue corpus is output by the own language model, and the output dialogue corpus is compared with the label of the training sample. The parameters of the own language model are adjusted according to the comparison result, thereby achieving supervised fine-tuning of the own language model. This fine-tuning process can enhance the dialogue generation capability of the own language model in a specific vertical field, and the specific vertical field is the field corresponding to the file pair. The language model at this stage is a small model with high efficiency and low cost.
[0065] The third stage is to generate large-scale high-quality dialogue corpus:
[0066] Figure 5 : is a schematic diagram of the third stage of the document generation method of an embodiment of the present disclosure. In this stage, a larger scale of chapter corpus, such as a chapter corpus of M2 (M2 is much larger than M1), is used to input into a fine-tuned efficient and low-cost small model. In this way, the efficient and low-cost small model can output large-scale high-quality dialogue corpus to meet the needs of specific vertical fields. In this stage, the chapter corpus used can be collected from books, research reports, blogs, etc.
[0067] In order to achieve a customized response style for the dialogue corpus, the disclosed embodiment can input a small amount of passage corpus with a specific expression style (such as a specific tone, voice, and expression method, etc.) into the existing large language model in the first stage. By introducing data of these specific expression styles, the existing large language model can generate dialogue corpus that imitates this specific expression style.
[0068] In some implementations, an example prompt for inputting an existing large language model in the first stage is:
[0069] "Generate a dialogue corpus based on the following passage corpus. The two parties in the dialogue are the teacher and the student.
[0070] Example 1:
[0071] Input: "Dream of Red Mansions" is one of the four great classical Chinese novels. Its popular version has 120 chapters. It is generally believed that the first 80 chapters were written by Cao Xueqin, a writer in the Qing Dynasty, and the author of the last 40 chapters is unknown. The editors are Cheng Weiyuan and Gao E. The novel is set against the background of the rise and fall of the four major families of Jia, Shi, Wang, and Xue. The main plot is the love and marriage tragedy of Jia Baoyu, Lin Daiyu, and Xue Baochai. It depicts the various aspects of life and is an epic work.
[0072] Output:
[0073] Student A: Teacher, I am reading A Dream of Red Mansions, but I feel that the content is so rich that I don’t know where to start.
[0074] Teacher: "Dream of Red Mansions" is indeed rich in content. You can start with its main plot, which is the love and marriage tragedy between Jia Baoyu, Lin Daiyu and Xue Baochai.
[0075] Student A: I understand. Who is the author of this book?
[0076] Teacher: It is generally believed that the first 80 chapters of Dream of the Red Chamber were written by Cao Xueqin, a famous writer in the Qing Dynasty. The last 40 chapters were written by an unknown author and later edited and published by Cheng Weiyuan and Gao E.
[0077] Student A: Oh, what about the background of this book?
[0078] Teacher: The background of "Dream of Red Mansions" is the rise and fall of the four major families: Jia, Shi, Wang and Xue.
[0079] The chapter corpus that needs to be converted now is as follows:
[0080] enter:
[0081] The Romance of the Three Kingdoms is a long historical novel written in chapters by Luo Guanzhong, a novelist in the late Yuan Dynasty and early Ming Dynasty. It is one of the four great masterpieces of Chinese classical literature. The Romance of the Three Kingdoms describes the historical events of nearly a hundred years from the end of the Eastern Han Dynasty to the beginning of the Western Jin Dynasty. It mainly describes wars, and describes the political and military struggles among the three kingdoms of Wei, Shu, and Wu in the late Eastern Han Dynasty.
[0082] Based on the above prompt, the existing large language model can generate the dialogue corpus corresponding to the "text corpus to be converted" contained in the prompt.
[0083] By inputting a small amount of the above-mentioned type of prompts, the existing large language model can generate multiple dialogue corpora, thereby generating multiple file pairs, each of which includes a chapter corpus and its corresponding dialogue corpus. The multiple file pairs are used to fine-tune the own language model in the second stage. In order to improve the quality of the file pairs generated in the first stage, thereby improving the fine-tuning effect of the own language model, the embodiments of the present disclosure can at least adopt the following methods:
[0084] Method 1:
[0085] In one example, a text corpus is input into a first model (such as an existing large language model), and the first model outputs a plurality of dialogue questions related to the text corpus;
[0086] Based on the passage corpus and the multiple dialogue questions, the first model outputs corresponding dialogue corpus, where the dialogue corpus includes the multiple dialogue questions and answers to the respective dialogue questions.
[0087] Through the above method, the first model (such as an existing large language model) can be guided to generate dialogue corpus in steps, that is, in the first step, dialogue questions in the dialogue corpus are generated, and in the second step, answers to each dialogue question are generated to form a complete dialogue corpus. This method can guide the large language model to complete the work of each step in a more detailed manner, and the work completed in each step is relatively simple, so it can improve the effect of the large language model, thereby improving the quality of the document pair, and further improving the fine-tuning effect of the second model (such as the own language model).
[0088] For example, a typical prompt for entering the first model is as follows:
[0089] “Please ask multiple dialogue questions based on the following passages:
[0090] ..."
[0091] Input the prompt into the large language model. After the large language model outputs multiple dialogue questions corresponding to the passage corpus, input the following prompt into the large language model:
[0092] "Please generate dialogue corpus for the above passage corpus and the above multiple dialogue questions."
[0093] In the above example, two prompts are input to the first model successively; the first prompt contains the content of the passage corpus and requires the first model to output multiple dialogue questions corresponding to the passage corpus; the second prompt requires the first model to output the dialogue corpus corresponding to the passage corpus based on the aforementioned output. By outputting two prompts successively, the guidance to the first model is refined, thereby improving the effect of the first model in generating dialogue corpus.
[0094] Method 2:
[0095] A prompt is generated for the passage corpus, the prompt carrying the content of the passage corpus and the identity characteristics of the dialogue parties; the identity characteristics of the dialogue parties are used to enable the first model (such as an existing large language model) to output dialogue corpus that meets the identity characteristics of the dialogue parties.
[0096] For example, in the prompt example above, "the two parties in the conversation are a teacher and a student" is the identity feature of the two parties. By including the identity feature of the two parties in the prompt, the large language model can output a conversation corpus that conforms to the identity feature. By using the document pairs generated by this type of conversation corpus that conforms to the identity feature, the own language model can be fine-tuned in the second stage, so that the own language model can generate a conversation corpus that conforms to the identity feature of the two parties.
[0097] Method 3:
[0098] The prompt is optimized using a prompt optimization method; and the optimized prompt is then input into the first model (such as an existing large language model).
[0099] The disclosed embodiment may adopt Chain-of-Thought (CoT), In-Context Learning (ICL), and self-optimization methods to optimize prompts, thereby improving the effect of the first model in the first stage and optimizing the output results of the first stage.
[0100] Thinking chain is a method for designing prompts, that is, in addition to the input and output of the task, the prompt also contains the intermediate steps of reasoning (intermediate thinking). Thinking chain can greatly improve the ability of LLM.
[0101] ICL is a method that enables a large language model to learn on a specific task through a small number of labeled samples. The core idea of this method is to form a prompt template by designing task-related instructions and using a small number of labeled samples as prompts to guide the model to generate prediction results on new test data.
[0102] The core idea of self-optimization is to let the large language model optimize the prompt itself. Specifically, the large language model records past iteration records, optimizes the target, summarizes the rules by itself, and gradually iterates the prompt.
[0103] The above methods can optimize the prompt. The optimized prompt can improve the performance of the first model, that is, improve the effect of the first model in generating dialogue corpus.
[0104] Method 4:
[0105] The passage corpus input to the first model (such as an existing large language model) has a preset expression style, and the prompt input to the first model contains the identity characteristics of the dialogue parties. After the first model outputs the corresponding dialogue corpus, dialogue corpus inconsistent with the preset expression style and dialogue corpus inconsistent with the identity characteristics are removed from the output results of the first model to obtain the remaining output results;
[0106] Multiple file pairs are determined based on the remaining output results.
[0107] This process cleans the output of the first model to remove lower quality document pairs.
[0108] In some embodiments, the first model may be used to determine the expression style and / or identity characteristics of the dialogue corpus generated by the first model, for example, the dialogue corpus generated by the first model is re-input into the first model, and the expression style and / or identity characteristics of the dialogue corpus are determined by the first model. Alternatively, other neural network models may be used to determine the expression style and / or identity characteristics of the dialogue corpus output by the first model.
[0109] By cleaning the output results of the first model in the first stage, higher-quality file pairs can be obtained. In the second stage, these higher-quality file pairs are used to adjust the second model, which can improve the performance of the second model.
[0110] Through the above-mentioned methods, the quality of the file pairs generated by the first model in the first stage can be improved; in the subsequent process, using higher quality file pairs to adjust the second model can make the performance of the adjusted second model better, thereby making the quality of the files generated by the adjusted second model higher.
[0111] In summary, it can be seen that the file generation method proposed in the embodiment of the present disclosure can generate a small number of training samples in a specific vertical field using a small amount of sample data and an existing large language model. The training samples are used to fine-tune the own language model, which can improve the ability of the own language model in the specific vertical field; then a large amount of chapter corpus is input into the adjusted language model, and a large amount of dialogue corpus is generated by the adjusted language model. By generating large-scale high-quality dialogue corpora, the needs of specific vertical fields can be better met. These dialogue corpora can cover professional knowledge, problem solving, common scenarios, etc. in a specific field, making the application of related products in this field more comprehensive and practical.
[0112] Furthermore, the document generation method proposed in the embodiment of the present disclosure can effectively protect data privacy by converting confidential text corpus into a local proprietary language model and fine-tuning it using an existing large language model. At the same time, compared with directly using an existing large language model, this solution can save costs and reduce the cost of using a large language model.
[0113] By using the dialogue corpus generated by the document generation method proposed in the embodiment of the present disclosure, it is possible to build one's own large language model, and perform fine-tuning and optimization in specific vertical fields, so that the own large language model has unique technical advantages and differentiated characteristics.
[0114] The present disclosure also provides a file generation device. Figure 6 is a schematic diagram of the structure of a file generating device 600 according to an embodiment of the present disclosure, comprising:
[0115] A first input module 601, used to input M1 first-type files into a first model respectively, and the first model outputs a second-type file corresponding to each first-type file;
[0116] A determination module 602 is used to determine a plurality of file pairs according to the output result, each file pair including a first type file and a second type file corresponding to the first type file;
[0117] An adjustment module 603 is used to adjust the second model using multiple file pairs; and
[0118] The second input module 604 is used to input M2 first type files into the adjusted second model respectively, and the adjusted second model outputs the second type files corresponding to each first type file; M1 and M2 are positive integers.
[0119] In some embodiments, M2 is greater than M1.
[0120] In some implementations, the M2 first type files include files that require security protection.
[0121] In some implementations, the first type of file includes text corpus, and the second type of file includes dialogue corpus.
[0122] In some embodiments, the first input module 601 is used to:
[0123] Inputting the text corpus into the first model, and having the first model output a plurality of dialogue questions related to the text corpus;
[0124] Based on the passage corpus and the multiple dialogue questions, the first model outputs corresponding dialogue corpus, where the dialogue corpus includes the multiple dialogue questions and answers to the respective dialogue questions.
[0125] In some embodiments, the first input module 601 is used to generate prompt words for each passage corpus and input the prompt words into the first model; wherein the prompt words carry the content of the passage corpus and the identity characteristics of the interlocutor; the identity characteristics of the interlocutor are used to enable the first model to output dialogue corpus that meets the identity characteristics of the interlocutor.
[0126] In some implementations, the first input module 601 is used to:
[0127] Using the prompt word optimization method to optimize the prompt words;
[0128] The optimized prompt words are input into the first model.
[0129] In some implementations, the text corpus has a preset expression style.
[0130] In some implementations, the determining module 602 is configured to:
[0131] From the output results of the first model, remove the dialogue data that is inconsistent with the preset expression style, and remove the dialogue data that is inconsistent with the identity characteristics of the dialogue party, so as to obtain the remaining output results;
[0132] Multiple file pairs are determined based on the remaining output results.
[0133] For the description of specific functions and examples of each module and submodule of the device in the embodiment of the present disclosure, reference can be made to the relevant description of the corresponding steps in the above method embodiment, which will not be repeated here.
[0134] In the technical solution disclosed in the present invention, the acquisition, storage and application of personal information of users involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0135] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0136] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0137] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0138] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0139] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as detection methods. For example, in some embodiments, the detection method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the detection method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the detection method in any other appropriate manner (e.g., by means of firmware).
[0140] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0141] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0142] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0143] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0144] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0145] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0146] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0147] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating a file, include: Input M1 first-type files into a first model respectively, and the first model outputs a second-type file corresponding to each first-type file; Determine a plurality of file pairs according to the output result, each file pair including a file of the first type and a file of the second type corresponding to the file of the first type; Using the plurality of file pairs, adjusting the second model; as well as, M2 first-type files are respectively input into the adjusted second model, and the adjusted second model outputs second-type files corresponding to each first-type file; M1 and M2 are positive integers.
2. The method according to claim 1, in, The M2 is greater than the M1.
3. The method according to claim 1 or 2, in, The M2 first type files include files that require security protection.
4. The method according to any one of claims 1 to 3, in, The first type of file includes text corpus, and the second type of file includes dialogue corpus.
5. The method according to claim 4, in, The step of inputting M1 first-type files into a first model respectively, and outputting second-type files corresponding to each first-type file by the first model, comprises: Inputting the passage corpus into the first model, and having the first model output a plurality of dialogue questions related to the passage corpus; Based on the text corpus and the multiple dialogue questions, the first model outputs corresponding dialogue corpus, where the dialogue corpus includes the multiple dialogue questions and answers to the respective dialogue questions.
6. The method according to claim 4 or 5, in, The step of inputting M1 files of the first type into the first model respectively includes: Generate prompt words for each of the chapter corpora, and input the prompt words into the first model; wherein, The prompt word carries the content of the passage corpus and the identity characteristics of the dialogue party; the identity characteristics of the dialogue party are used to enable the first model to output dialogue corpus that meets the identity characteristics of the dialogue party.
7. The method according to claim 6, in, The step of inputting the prompt word into the first model comprises: Adopting a prompt word optimization method to optimize the prompt word; The optimized prompt words are input into the first model.
8. The method according to claim 6 or 7, in, The text corpus has a preset expression style.
9. The method according to claim 8, in, The step of determining a plurality of file pairs according to the output result includes: From the output results of the first model, remove the dialogue data that is inconsistent with the preset expression style, and remove the dialogue data that is inconsistent with the identity characteristics of the dialogue party, so as to obtain the remaining output results; A plurality of file pairs are determined according to the remaining output results.
10. A file generating device, include: A first input module, used to input M1 first-type files into a first model respectively, and the first model outputs a second-type file corresponding to each first-type file; a determination module, configured to determine a plurality of file pairs according to the output result, each file pair comprising a file of the first type and a file of the second type corresponding to the file of the first type; An adjustment module, configured to adjust the second model using the plurality of file pairs; as well as, The second input module is used to input M2 first type files into the adjusted second model respectively, and the adjusted second model outputs the second type files corresponding to each first type file; M1 and M2 are positive integers.
11. The device according to claim 10, in, The M2 is greater than the M1.
12. The device according to claim 10 or 11, in, The M2 first type files include files that require security protection.
13. The device according to any one of claims 10 to 12, in, The first type of file includes text corpus, and the second type of file includes dialogue corpus.
14. The device according to claim 13, in, The first input module is used to: Inputting the passage corpus into the first model, and having the first model output a plurality of dialogue questions related to the passage corpus; Based on the text corpus and the multiple dialogue questions, the first model outputs corresponding dialogue corpus, where the dialogue corpus includes the multiple dialogue questions and answers to the respective dialogue questions.
15. The device according to claim 13 or 14, in, The first input module is used to generate prompt words for each of the passage corpora and input the prompt words into the first model; wherein the prompt words carry the content of the passage corpora and the identity characteristics of the interlocutors; the identity characteristics of the interlocutors are used to enable the first model to output dialogue corpora that meet the identity characteristics of the interlocutors.
16. The device according to claim 15, in, The first input module is used for: Adopting a prompt word optimization method to optimize the prompt word; The optimized prompt words are input into the first model.
17. The device according to claim 15 or 16, in, The text corpus has a preset expression style.
18. The device according to claim 17, in, The determination module is used for: From the output results of the first model, remove the dialogue data that is inconsistent with the preset expression style, and remove the dialogue data that is inconsistent with the identity characteristics of the dialogue party, so as to obtain the remaining output results; A plurality of file pairs are determined according to the remaining output results.
19. An electronic device, include: at least one processor; as well as 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 to enable the at least one processor to perform the method according to any one of claims 1 to 9.
20. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.
21. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Text processing model training method and text processing method and device
CN112487182A
Data generation method and device, electronic equipment and medium
CN116992112A
Virtual anchor dialogue model processing method and device and electronic equipment
CN117253480A
Large model domain migration training method and system and text generation method and system
CN118261269A
Generating question answer pairs
US20220358851A1
Cited By
Value identification data enhancement method based on large language model
CN119415962A
