Method and device for obtaining preprocessed text for fine tuning of large language model

Through the integration of quantitative statistics and conversation templates, high-quality preprocessed text is generated, which solves the problems of poor quality of preprocessed text and high manual writing cost in the prior art, and realizes efficient and accurate preprocessed text acquisition by fine-tuning of large language models.

CN119558290AActive Publication Date: 2025-03-04TONGFANG KNOWLEDGE DIGITAL PUBLISHING TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411549961.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-03-04
Estimated Expiration
2044-11-01

AI Technical Summary

Technical Problem

The existing preprocessed text acquisition methods used to fine-tune large language models are of poor quality, cannot guarantee the practicality of the scene of the large model, and are highly cost-effective in manual writing and inefficient.

Method used

By determining the preprocessing task of the large language model to be processed, quantified statistics obtain quantized elements, and the matching session template is called, and the search constraints of the target search field are determined based on the quantitative elements and session templates. The text object is searched and integrated with the session template is generated to generate preprocessed text for fine-tuning the large language model.

Benefits of technology

It realizes high matching between fine-tuned corpus and tasks, automatically generates fine-tuned corpus, reduces human resource requirements, and improves the accuracy and effectiveness of preprocessed text acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119558290A_ABST
    Figure CN119558290A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for obtaining a preprocessed text for fine tuning of a large language model, relates to the technical field of text processing, and mainly aims to solve the problem of obtaining the preprocessed text for fine tuning of the large language model in the prior art. Comprising the steps that a preprocessing task of a to-be-processed large language model is determined, quantitative statistics is conducted on the preprocessing task, quantitative elements are obtained, and the preprocessing task is used for representing the content, suitable for a specific language processing scene, of the large language model; calling a session template matched with the preprocessing task, and determining a retrieval constraint condition of a target retrieval field based on the quantitative element and the session template; and in response to a text object retrieval instruction, searching a text object in the target retrieval field according to the retrieval constraint condition, and integrating the searched text object with the session template to obtain a pre-processed text, so as to finely adjust the large language model based on the pre-processed text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of text processing, and in particular to a method and device for obtaining preprocessed text for fine-tuning a large language model. Background Art

[0002] With the rapid development of natural language processing technology, generative pre-trained large models may not perform well in some specific tasks or fields. In this case, it is usually necessary to use fine-tuning corpus as pre-processed text to fine-tune the large model. Among them, the common form of large model (LLM) fine-tuning corpus is the "one question and one answer" question and answer format, which can achieve a variety of tasks such as generating outlines, generating summaries, continuing texts, extracting keywords, and translating.

[0003] At present, the generation of existing preprocessed texts usually includes screening from source corpus or manual writing. However, there is a large error between the preprocessed text screened from the source corpus and the processing task, which makes the quality of the preprocessed text poor and cannot guarantee the practicality of the large model scenario. In addition, manual writing requires a lot of human resources, puts high demands on the professional knowledge of the staff, is costly, and greatly reduces the effectiveness of preprocessed text acquisition. Summary of the invention

[0004] In view of this, the present invention provides a method and device for obtaining preprocessed text for fine-tuning a large language model, the main purpose of which is to solve the problem of obtaining preprocessed text for fine-tuning a large language model.

[0005] According to one aspect of the present invention, a method for obtaining preprocessed text for fine-tuning a large language model is provided, comprising:

[0006] Determine a preprocessing task of the large language model to be processed, and perform quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario;

[0007] Retrieving a conversation template matching the preprocessing task, and determining a search constraint condition of a target search field based on the quantitative elements and the conversation template;

[0008] In response to a text object retrieval instruction, the text object is searched in the target retrieval field according to the retrieval constraint condition, and the searched text object is integrated with the conversation template to obtain a preprocessed text, so as to fine-tune the large language model based on the preprocessed text.

[0009] Furthermore, the quantitative statistics of the preprocessing task are performed to obtain the quantitative elements including:

[0010] Acquire the historical conversation text of the preprocessing task, and perform template splitting on the historical conversation text to obtain the answer text;

[0011] Determine the element objects in the answer text that match the preprocessing task, and count the number of the element objects in the answer text;

[0012] A quantitative element is generated based on the element object, the quantity, and a preset element condition matching the element object.

[0013] Furthermore, the retrieval constraint conditions for determining the target retrieval field based on the quantitative elements and the conversation template include:

[0014] receiving a selected target search field;

[0015] Extracting element limiting condition information of the quantified element according to the conversation template;

[0016] A search constraint condition is generated based on the target search field and the element limitation condition information.

[0017] Furthermore, the preprocessing task of determining the large language model to be processed includes:

[0018] In response to the text generation instruction, obtaining an expected target for expected large language model processing;

[0019] Preprocessing tasks matching the expected target are searched according to different task types, and different preprocessing tasks are matched with different task types.

[0020] Furthermore, the step of integrating the searched text object with the conversation template to obtain the preprocessed text includes:

[0021] Parsing the question template and the answer template of the conversation template according to the preprocessing task;

[0022] Extracting the question text matching the question template and the answer text matching the answer template from the text object;

[0023] The question text and the answer text are combined according to the conversation template to obtain a preprocessed text.

[0024] Furthermore, before the searched text object is integrated with the conversation template to obtain the preprocessed text, the method further includes:

[0025] Acquiring sensitive information matching the preprocessing task;

[0026] If the sensitive information exists in the text object, the sensitive information in the text object is deleted, or the sensitive information in the text object is replaced by preset characters, so as to integrate the text object after deleting the sensitive information or replacing the sensitive information.

[0027] Furthermore, the method further comprises:

[0028] Determining a compilation format of the large language model;

[0029] If the text format of the preprocessed text does not match the editing format, the preprocessed text is converted according to the compilation format, so as to perform preprocessing based on the converted preprocessed text.

[0030] According to another aspect of the present invention, a device for obtaining preprocessed text for fine-tuning a large language model is provided, comprising:

[0031] A determination module, used to determine a preprocessing task of a large language model to be processed, and to perform quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario;

[0032] A calling module, used to call a conversation template matching the preprocessing task, and determine the search constraint conditions of the target search field based on the quantitative elements and the conversation template;

[0033] The integration module is used to respond to the text object retrieval instruction, search for text objects in the target retrieval field according to the retrieval constraints, and integrate the searched text objects with the conversation template to obtain preprocessed text, so as to fine-tune the large language model based on the preprocessed text.

[0034] Furthermore, the determination module is specifically used to obtain the historical conversation text of the preprocessing task, and perform template splitting on the historical conversation text to obtain an answer text; determine the element objects in the answer text that match the preprocessing task, and count the number of the element objects in the answer text; and generate quantitative elements based on the element objects, the number, and the preset element conditions that match the element objects.

[0035] Furthermore, the retrieval module is specifically used to receive a selected target search field; extract the element limitation condition information of the quantitative element according to the conversation template; and generate a search constraint condition based on the target search field and the element limitation condition information.

[0036] Furthermore, the determination module is specifically used to respond to the text generation instruction to obtain the expected goal of the large language model processing; query the preprocessing tasks matching the expected goal according to different task types, and different task types match different preprocessing tasks.

[0037] Furthermore, the integration module is used to parse the question template and the answer template of the conversation template according to the preprocessing task; extract the question text matching the question template and the answer text matching the answer template in the text object; and combine the question text and the answer text according to the conversation template to obtain the preprocessed text.

[0038] Furthermore, the device also includes:

[0039] An acquisition module, used to acquire sensitive information matching the preprocessing task;

[0040] A deletion module is used to delete the sensitive information in the text object if it exists, or to replace the sensitive information in the text object with preset characters, so as to integrate the text object after deleting the sensitive information or replacing the sensitive information.

[0041] Furthermore, the determination module is also used to determine the compilation format of the large language model; if the text format of the preprocessed text does not match the editing format, the preprocessed text is converted according to the compilation format, so as to perform preprocessing based on the converted preprocessed text.

[0042] According to another aspect of the present invention, a storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned method for obtaining preprocessed text for fine-tuning a large language model.

[0043] According to another aspect of the present invention, there is provided a terminal, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0044] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the above-mentioned method for obtaining preprocessed text for fine-tuning a large language model.

[0045] By means of the above technical solution, the technical solution provided by the embodiment of the present invention has at least the following advantages:

[0046] The present invention provides a method and device for obtaining preprocessed text for fine-tuning a large language model. Compared with the prior art, the embodiment of the present invention determines a preprocessing task of a large language model to be processed, and performs quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario; retrieves a conversation template matching the preprocessing task, and determines a search constraint condition of a target search field based on the quantitative factor and the conversation template; in response to a text object search instruction, searches for a text object in the target search field according to the search constraint condition, and integrates the searched text object with the conversation template to obtain a preprocessed text, so as to fine-tune the large language model based on the preprocessed text, achieve high matching between the fine-tuning corpus and the task, and achieve the purpose of automatically generating the fine-tuning corpus, thereby reducing a large amount of human resources, thereby achieving the accuracy and effectiveness of obtaining the preprocessed text for fine-tuning the large language model.

[0047] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0049] Figure 1 A flow chart of a method for obtaining preprocessed text for fine-tuning a large language model provided by an embodiment of the present invention is shown;

[0050] Figure 2 A block diagram of a device for obtaining preprocessed text for fine-tuning a large language model provided by an embodiment of the present invention is shown;

[0051] Figure 3 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0052] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0053] The embodiment of the present invention provides a method for obtaining preprocessed text for fine-tuning a large language model, such as Figure 1 As shown, the method includes:

[0054] 101. Determine a preprocessing task of the large language model to be processed, and perform quantitative statistics on the preprocessing task to obtain quantitative factors.

[0055] In the embodiment of the present invention, as the execution subject for generating preprocessed text when fine-tuning the large language model, the current execution end can be a server or a cloud server, or a terminal device or a client device, that is, a large amount of text data in different fields can be searched to construct the required preprocessed text for fine-tuning the large language model. Among them, the large language model (Large Language Model, LLM for short) is a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. It can handle a variety of natural language tasks, such as text classification, question and answer, dialogue, etc., including but not limited to LLaMA, ChatGLM and BLOOM, etc., which are not specifically limited in the embodiment of the present invention. Among them, since the large language model needs to be pre-trained with different corpora for different language recognition requirements, after the pre-training is completed, in order to make the large language model more suitable for business scenario requirements, it is necessary to fine-tune the targeted corpus. Therefore, in the embodiment of the present invention, the preprocessing task of the large language model to be fine-tuned is first determined. At this time, the preprocessing task is used to characterize the content of the large language model applicable to specific language processing scenarios, including but not limited to open and closed questions and answers, text generation, information extraction, multilingual translation, sentiment analysis, content recommendation, etc., which can be configured and determined based on different business parties, or determined based on the task labeling of the pre-trained samples of the large language model, and can also be based on automated scoring tools such as BLEU, METEOR, ROUGE, etc. The output results of different tasks of the pre-trained large language model are scored, and the task type with a score lower than the preset target value is determined as the fine-tuning task type, which is not specifically limited in the embodiment of the present invention.

[0056] It should be noted that in order to make the preprocessed text to be generated more standardized, the current execution end performs quantitative statistics on the determined preprocessing tasks. At this time, the quantitative factors are the numerical requirements for corpus extraction required for preprocessing tasks of different task types. For example, for the preprocessing tasks of the knowledge question and answer task type, the quantitative factors obtained by quantitative statistics are the total number of characters of the answer between 300-800, which is not specifically limited in the embodiments of the present invention.

[0057] 102. Retrieve a conversation template that matches the preprocessing task, and determine a search constraint condition of a target search field based on the quantitative elements and the conversation template.

[0058] In the embodiment of the present invention, the conversation template is used to characterize the template of the conversation corpus composed of the preprocessing task, including the question template and the answer template. At this time, different preprocessing tasks can be matched with one conversation template or multiple conversation templates, which is not specifically limited in the embodiment of the present invention. In addition, since it is necessary to fine-tune the large language model in the specified business, in order to make the specified business more adaptable and increase the diversity of the fine-tuning corpus, the retrieval field is used to characterize the subject field of the paper corpus, such as "Basic Science", "Engineering Technology I Series", "Engineering Technology II Series", "Agricultural Technology", "Medical and Health Technology" and other major fields, or several sub-fields in the full-field papers on a certain network, which is not specifically limited in the embodiment of the present invention. At the same time, the target retrieval field can be selected based on the task requirements or task types, or multiple target retrieval fields can be randomly determined, which is not specifically limited in the embodiment of the present invention. Furthermore, the retrieval constraints in the target retrieval field are determined according to the quantitative factors and the conversation template, so that the required content can be accurately retrieved according to this retrieval constraint.

[0059] It should be noted that when calling the conversation template, the current execution end can pre-compile the large model instruction (Prompt), such as GPT4, etc.) to abstract the template, wherein the expected number of question templates is obtained by configuring the quantity requirements in the instruction, and the answer template can be obtained based on the same method, which is not specifically limited in the embodiment of the present invention. In addition, the final conversation template can be determined based on manual checking and filling of the question and answer templates output by the large model, which is not specifically limited in the embodiment of the present invention.

[0060] The following is an example of a question template: Template: Please generate a paper outline for my [XXX] topic.

[0061] Templates for the same task type can also be:

[0062] 1. Help me design an outline for the paper title [XXX];

[0063] 2. I need to develop an outline for the paper title [XXX]. Please help me.

[0064] 3. Could you provide an outline for my paper title [XXX]?

[0065] 4. Please help me come up with an outline based on the paper title [XXX].

[0066] 103. In response to a text object retrieval instruction, search for text objects in the target retrieval field according to the retrieval constraints, and integrate the searched text objects with the conversation template to obtain preprocessed text, so as to fine-tune the large language model based on the preprocessed text.

[0067] In the embodiment of the present invention, the user triggers the retrieval instruction of the text object, instructing the current execution end to search for the text object in the target retrieval field according to the retrieval constraint conditions, that is, to search in the target retrieval field of academic papers according to the retrieval constraint conditions, and obtain the target number of paper corpora as text objects. Then, the searched text objects are integrated with the conversation template to obtain the preprocessed text, so as to fine-tune the large language model based on the preprocessed text.

[0068] It should be noted that when integrating text objects with conversation templates, the text objects can be inserted into the question template and the answer template in the order of questions and answers to obtain a complete question and answer corpus for fine-tuning the large language model.

[0069] The embodiment of the present invention provides a method for obtaining preprocessed text for fine-tuning a large language model. Compared with the prior art, the embodiment of the present invention determines a preprocessing task of a large language model to be processed, and performs quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario; retrieves a conversation template matching the preprocessing task, and determines a search constraint condition of a target retrieval field based on the quantitative factor and the conversation template; in response to a text object retrieval instruction, searches for a text object in the target retrieval field according to the search constraint condition, and integrates the searched text object with the conversation template to obtain a preprocessed text, so as to fine-tune the large language model based on the preprocessed text, achieve a high matching of the fine-tuning corpus with the task, and achieve the purpose of automatically generating the fine-tuning corpus, thereby reducing a large amount of human resources, thereby achieving the accuracy and effectiveness of obtaining the preprocessed text for fine-tuning the large language model.

[0070] In another embodiment of the present invention, for further definition and explanation, the step performs quantitative statistics on the preprocessing task to obtain quantitative elements including:

[0071] Acquire the historical conversation text of the preprocessing task, and perform template splitting on the historical conversation text to obtain the answer text;

[0072] Determine the element objects in the answer text that match the preprocessing task, and count the number of the element objects in the answer text;

[0073] A quantitative element is generated based on the element object, the quantity, and a preset element condition matching the element object.

[0074] In order to ensure the corpus quality of the preprocessed text and reduce the occurrence of situations such as unclear and ambiguous text meanings, the current execution end first obtains the historical conversation text of the preprocessing task when performing quantitative statistics, that is, the historical conversation text is the conversation text that has completed fine-tuning processing for the preprocessing task, and can include text content in any field. Furthermore, the current execution end performs template splitting on the historical conversation text, that is, splitting the historical conversation text according to the form of questions and answers, question text and answer text, at this time, keywords (such as "question", "reply", etc.) can be used for splitting, or punctuation marks (such as ":", "?") that represent questions or declarative moods can be used for splitting, and the embodiment of the present invention does not make specific restrictions. After the current execution end splits and obtains the answer text, it determines the element objects in the answer text that match the preprocessing task. At this time, the element objects are used to represent the specific content in the form of replies in different task types. For example, for the knowledge question and answer task type, the corresponding element object is the number of answers, the outline generation task type, the corresponding element object is the outline level, and the continuation task type, the corresponding element object is the number of words and paragraphs. Query matching can be performed based on the pre-configured element correspondence relationship, and the embodiment of the present invention does not make specific restrictions. Furthermore, after the current execution end determines the element object, it counts the number of element objects from the answer text, for example, counting the number of paragraphs, the number of words, the number of outline levels, etc., and can use compiled query counting instructions for statistics, which is not specifically limited in the embodiment of the present invention.

[0075] It should be noted that after counting the number, a quantitative element is generated based on the element object, the number, and the preset element condition that matches the element object. At this time, the preset element condition is the condition for limiting the number of the element objects counted. For example, when the element object is the number of words, the number of words counted is 300. If the preset element condition is that the number of words cannot be more than 500, the generated quantitative element is the number of words between 300-500. The embodiment of the present invention does not make specific limitations. Table 1 shows the quantitative statistical results obtained by performing quantitative statistics on preprocessing tasks of different task types:

[0076] Table 1:

[0077]

[0078]

[0079] In another embodiment of the present invention, for further definition and explanation, the step of determining the search constraint conditions of the target search field based on the quantitative elements and the conversation template includes:

[0080] receiving a selected target search field;

[0081] Extracting element limiting condition information of the quantified element according to the conversation template;

[0082] A search constraint condition is generated based on the target search field and the element limitation condition information.

[0083] In order to achieve the purpose of automatic search of corpus content and improve the search efficiency of text objects, the current execution end first receives the target search field selected by the user when determining the search constraint conditions. Among them, the user can select one or more target search fields from all search fields through the current execution end, such as "Engineering Technology I Series", "Engineering Technology II Series", "Agricultural Technology", etc., which are not specifically limited in the embodiment of the present invention. Then, the element limiting condition information of the quantitative elements generated by the session template extraction is used. At this time, the element limiting condition information is the specific limiting content of the quantity, words, etc. in the quantitative elements. For example, if the quantitative elements have a word count requirement in the instruction, the requirement shall prevail, and the number of characters for the paragraph continuation that is not required in the instruction is between 500-1000, and the corresponding element limiting condition information is the number of characters 500-1000. At this time, extraction according to the session template is to determine the element limiting condition information according to the question template and the answer template, so that when entering the question or outputting the answer, the searched content can match the quantitative elements, which is not specifically limited in the embodiment of the present invention. Among them, the element restriction conditions include not only conditions such as quantity, but also specific conditions such as outline level and number of paragraphs, and include the template form in the conversation template as a restriction condition. Furthermore, the current execution end generates a search constraint condition based on the target search field and the element restriction condition information, that is, using this search constraint condition as a condition for retrieving text objects from the target search field, thereby accurately screening out useful and adapted texts as fine-tuning corpus.

[0084] In another embodiment of the present invention, for further definition and explanation, the step of determining the preprocessing task of the large language model to be processed includes:

[0085] In response to the text generation instruction, obtaining an expected target for expected large language model processing;

[0086] The pre-processing tasks matching the expected target are searched according to different task types.

[0087] In order to make the fine-tuning corpus more targeted and thus improve the accuracy of corpus construction, when the current execution end determines the preprocessing task, the current execution end can first receive a text generation instruction triggered by the user to instruct the current execution end to obtain the expected goal of the large language model. Among them, the expected goal is used to characterize the scenario goal of the large language model for corpus fine-tuning, and can be carried in the text generation instruction so that the current execution end can directly extract it from the instruction. Furthermore, according to different task types, the preprocessing tasks that match the expected goals are queried, and the current execution end has a correspondence between different task types and different preprocessing tasks in advance, so as to directly perform query matching. For example, if the task type is query, the corresponding preprocessing task is the query corpus fine-tuning task for the large language model, which is not specifically limited in the embodiments of the present invention.

[0088] In another embodiment of the present invention, for further definition and explanation, the step of integrating the searched text object with the conversation template to obtain the preprocessed text includes:

[0089] Parsing the question template and the answer template of the conversation template according to the preprocessing task;

[0090] Extracting the question text matching the question template and the answer text matching the answer template from the text object;

[0091] The question text and the answer text are combined according to the conversation template to obtain a preprocessed text.

[0092] In order to achieve the effectiveness of obtaining fine-tuning corpus, thereby improving the fine-tuning effect of the large language model, when the current execution end integrates the text object with the conversation template, specifically, first parse the question template and the answer template in the conversation template according to the preprocessing task. Among them, the question template is used to assist the user to enter the content to be retrieved, and the answer template is used to form a standard answer text from the retrieved text object, and then extract the question text that matches the question template from the retrieved text object, and extract the answer text that matches the answer template from the retrieved text object, so that the question text and the answer text are inserted into the conversation template for combination to obtain the preprocessed text. For example, the preprocessing task is to extract keywords, and the question template of the parsed conversation template is "What are the keywords of XXX article?", the answer template is "The keywords of XXX article are....", the question text that matches the question template in the extracted text object is "Y article", and the answer text that matches the answer template is "keyword A, keyword B, keyword C", and then, after combination, the preprocessed text obtained is "What are the keywords of Y article? The keywords of Y article are keyword A, keyword B, keyword C".

[0093] In a specific embodiment, as shown in Table 2, the preprocessed text finally generated for the task type is:

[0094] Table 2:

[0095]

[0096]

[0097]

[0098]

[0099] In another embodiment of the present invention, for further definition and explanation, before the text object searched in step is integrated with the conversation template to obtain the preprocessed text, the method further includes:

[0100] Acquiring sensitive information matching the preprocessing task;

[0101] If the sensitive information exists in the text object, the sensitive information in the text object is deleted, or the sensitive information in the text object is replaced by preset characters, so as to integrate the text object after deleting the sensitive information or replacing the sensitive information.

[0102] In order to ensure the validity of the text object and ensure data security, and to prevent invalid text content from affecting the fine-tuning effect of the fine-tuning corpus on the large language model, the current execution end can also obtain sensitive information that matches the preprocessing task before integration. Different preprocessing tasks can pre-configure different sensitive information. At this time, sensitive information includes but is not limited to addresses, mobile phone numbers, ID numbers, insults, prejudices and other information, which are not specifically limited in the embodiments of the present invention. After the current execution end obtains the sensitive information, it matches the text words in the text object with the sensitive information in turn. If the above sensitive information exists in the text object, the sensitive information in the text object can be deleted, or the above sensitive information can be replaced by preset characters, where the preset characters include but are not limited to spaces, specified letters or numbers, etc., so as to desensitize the text object.

[0103] In another embodiment of the present invention, for further definition and description, the steps further include:

[0104] Determining a compilation format of the large language model;

[0105] If the text format of the preprocessed text does not match the editing format, the preprocessed text is converted according to the compilation format, so as to perform preprocessing based on the converted preprocessed text.

[0106] In order to meet the flexible fine-tuning processing requirements of different large language models and improve the fine-tuning efficiency of the large language model based on the preprocessed text, the current execution end first determines the compilation format of the large language model, such as json format, etc., which is not specifically limited in the embodiment of the present invention. Then, it is determined whether the text format of the preprocessed text matches the compilation format. If not, it means that the integrated preprocessed text cannot be directly input as fine-tuning corpus into the large language model for fine-tuning processing. Therefore, the preprocessed text is converted according to the compilation format and converted into a preprocessed text in the compilation format, so that the large language model can be fine-tuned according to the converted preprocessed text.

[0107] The embodiment of the present invention provides another method for obtaining preprocessed text for fine-tuning a large language model. Compared with the prior art, the embodiment of the present invention determines a preprocessing task of a large language model to be processed, and performs quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario; retrieves a conversation template matching the preprocessing task, and determines a search constraint condition of a target retrieval field based on the quantitative factor and the conversation template; in response to a text object retrieval instruction, searches for a text object in the target retrieval field according to the search constraint condition, and integrates the searched text object with the conversation template to obtain a preprocessed text, so as to fine-tune the large language model based on the preprocessed text, achieve a high matching of the fine-tuning corpus with the task, and achieve the purpose of automatically generating the fine-tuning corpus, thereby reducing a large amount of human resources, thereby achieving the accuracy and effectiveness of obtaining the preprocessed text for fine-tuning the large language model.

[0108] Furthermore, as a response to the above Figure 1 The implementation of the method shown in the figure, the embodiment of the present invention provides a device for obtaining preprocessed text for fine-tuning a large language model, such as Figure 2 As shown, the device comprises:

[0109] A determination module 21 is used to determine a preprocessing task of a large language model to be processed, and to perform quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario;

[0110] A retrieval module 22, used to retrieve a conversation template matching the preprocessing task, and determine a retrieval constraint condition of a target retrieval field based on the quantitative elements and the conversation template;

[0111] The integration module 23 is used to respond to the text object retrieval instruction, search for text objects in the target retrieval field according to the retrieval constraints, and integrate the searched text objects with the conversation template to obtain preprocessed text, so as to fine-tune the large language model based on the preprocessed text.

[0112] Furthermore, the determination module is specifically used to obtain the historical conversation text of the preprocessing task, and perform template splitting on the historical conversation text to obtain an answer text; determine the element objects in the answer text that match the preprocessing task, and count the number of the element objects in the answer text; and generate quantitative elements based on the element objects, the number, and the preset element conditions that match the element objects.

[0113] Furthermore, the retrieval module is specifically used to receive a selected target search field; extract the element limitation condition information of the quantitative element according to the conversation template; and generate a search constraint condition based on the target search field and the element limitation condition information.

[0114] Furthermore, the determination module is specifically used to respond to the text generation instruction to obtain the expected goal of the large language model processing; query the preprocessing tasks matching the expected goal according to different task types, and different task types match different preprocessing tasks.

[0115] Furthermore, the integration module is used to parse the question template and the answer template of the conversation template according to the preprocessing task; extract the question text matching the question template and the answer text matching the answer template in the text object; and combine the question text and the answer text according to the conversation template to obtain the preprocessed text.

[0116] Furthermore, the device also includes:

[0117] An acquisition module, used to acquire sensitive information matching the preprocessing task;

[0118] A deletion module is used to delete the sensitive information in the text object if it exists, or to replace the sensitive information in the text object with preset characters, so as to integrate the text object after deleting the sensitive information or replacing the sensitive information.

[0119] Furthermore, the determination module is also used to determine the compilation format of the large language model; if the text format of the preprocessed text does not match the editing format, the preprocessed text is converted according to the compilation format, so as to perform preprocessing based on the converted preprocessed text.

[0120] The embodiment of the present invention provides a device for obtaining preprocessed text for fine-tuning a large language model. Compared with the prior art, the embodiment of the present invention determines a preprocessing task of a large language model to be processed, and performs quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario; retrieves a conversation template matching the preprocessing task, and determines a search constraint condition of a target retrieval field based on the quantitative factor and the conversation template; in response to a text object retrieval instruction, searches for a text object in the target retrieval field according to the search constraint condition, and integrates the searched text object with the conversation template to obtain a preprocessed text, so as to fine-tune the large language model based on the preprocessed text, achieve high matching between the fine-tuning corpus and the task, and achieve the purpose of automatically generating the fine-tuning corpus, thereby reducing a large amount of human resources, thereby achieving the accuracy and effectiveness of obtaining the preprocessed text for fine-tuning the large language model.

[0121] According to one embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the method for obtaining preprocessed text for fine-tuning a large language model in any of the above method embodiments.

[0122] Figure 3 A schematic diagram of the structure of a terminal provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the terminal.

[0123] like Figure 3 As shown, the terminal may include: a processor (processor) 302 , a communication interface (Communications Interface) 304 , a memory (memory) 306 , and a communication bus 308 .

[0124] The processor 302 , the communication interface 304 , and the memory 306 communicate with each other via the communication bus 308 .

[0125] The communication interface 304 is used to communicate with other devices such as clients or other servers.

[0126] The processor 302 is used to execute the program 310, and specifically can execute the relevant steps in the above-mentioned embodiment of the method for obtaining preprocessed text for fine-tuning a large language model.

[0127] Specifically, the program 310 may include program codes, which include computer operation instructions.

[0128] The processor 302 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present invention. The one or more processors included in the terminal may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0129] The memory 306 is used to store the program 310. The memory 306 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0130] The program 310 may be specifically configured to enable the processor 302 to perform the following operations:

[0131] Determine a preprocessing task of the large language model to be processed, and perform quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario;

[0132] Retrieving a conversation template matching the preprocessing task, and determining a search constraint condition of a target search field based on the quantitative elements and the conversation template;

[0133] In response to a text object retrieval instruction, the text object is searched in the target retrieval field according to the retrieval constraint condition, and the searched text object is integrated with the conversation template to obtain a preprocessed text, so as to fine-tune the large language model based on the preprocessed text.

[0134] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0135] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for obtaining preprocessed text for fine-tuning a large language model, characterized in that: include: Determine a preprocessing task of the large language model to be processed, and perform quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario; Retrieving a conversation template matching the preprocessing task, and determining a search constraint condition of a target search field based on the quantitative elements and the conversation template; In response to a text object retrieval instruction, the text object is searched in the target retrieval field according to the retrieval constraint condition, and the searched text object is integrated with the conversation template to obtain a preprocessed text, so as to fine-tune the large language model based on the preprocessed text.

2. The method according to claim 1, characterized in that The quantitative statistics of the preprocessing task are performed to obtain the quantitative elements including: Acquire the historical conversation text of the preprocessing task, and perform template splitting on the historical conversation text to obtain the answer text; Determine the element objects in the answer text that match the preprocessing task, and count the number of the element objects in the answer text; A quantitative element is generated based on the element object, the quantity, and a preset element condition matching the element object.

3. The method according to claim 2, characterized in that The retrieval constraint conditions for determining the target retrieval field based on the quantitative elements and the conversation template include: receiving a selected target search field; Extracting element limiting condition information of the quantified element according to the conversation template; A search constraint condition is generated based on the target search field and the element limitation condition information.

4. The method according to claim 1, characterized in that: The preprocessing task of determining the large language model to be processed includes: In response to the text generation instruction, obtaining an expected target for expected large language model processing; Preprocessing tasks matching the expected target are searched according to different task types, and different preprocessing tasks are matched with different task types.

5. The method according to claim 1, characterized in that The step of integrating the searched text object with the conversation template to obtain a preprocessed text comprises: Parsing the question template and the answer template of the conversation template according to the preprocessing task; Extracting the question text matching the question template and the answer text matching the answer template from the text object; The question text and the answer text are combined according to the conversation template to obtain a preprocessed text.

6. The method according to claim 1, characterized in that Before integrating the searched text object with the conversation template to obtain the preprocessed text, the method further includes: Acquiring sensitive information matching the preprocessing task; If the sensitive information exists in the text object, the sensitive information in the text object is deleted, or the sensitive information in the text object is replaced by preset characters, so as to integrate the text object after deleting the sensitive information or replacing the sensitive information.

7. The method according to claim 1, characterized in that The method further comprises: Determining a compilation format of the large language model; If the text format of the preprocessed text does not match the editing format, the preprocessed text is converted according to the compilation format, so as to perform preprocessing based on the converted preprocessed text.

8. A device for obtaining preprocessed text for fine-tuning a large language model, characterized in that: include: A determination module, used to determine a preprocessing task of a large language model to be processed, and to perform quantitative statistics on the preprocessing task to obtain a quantitative factor, wherein the preprocessing task is used to characterize the content of the large language model applicable to a specific language processing scenario; A calling module, used to call a conversation template matching the preprocessing task, and determine the search constraint conditions of the target search field based on the quantitative elements and the conversation template; The integration module is used to respond to the text object retrieval instruction, search for text objects in the target retrieval field according to the retrieval constraints, and integrate the searched text objects with the conversation template to obtain preprocessed text, so as to fine-tune the large language model based on the preprocessed text.

9. A storage medium storing at least one executable instruction, wherein the executable instruction enables a processor to perform operations corresponding to the method for obtaining preprocessed text for fine-tuning a large language model as described in any one of claims 1-7.

10. A terminal, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the method for obtaining preprocessed text for fine-tuning a large language model as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method and system for finely adjusting pre-training language large model based on structured data

    CN117271734A

  • Data processing method and device, equipment and storage medium

    CN117520523A

  • Ultra-long text question and answer data acquisition method and large language model training method

    CN117951273A

  • Data standardization processing method and device based on large language model

    CN118113829A

  • Text generation method and device, equipment and storage medium

    CN118227752A