Text processing method and device based on large language model
By selecting the appropriate large language model based on the target generation task of the text to be processed, the problem of how to select the appropriate model from multiple large language models is solved, and the accuracy and quality of text processing are improved.
Patent Information
- Application Number
- CN202311241520.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-25
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2043-09-25
AI Technical Summary
How to select a suitable large language model from multiple large language models to process text, and avoid the problem that the target text does not meet expectations caused by using a single model or the inability to select a suitable model.
By obtaining the pending text and determining the target generation task, obtaining the target index value of the candidate large language model based on the target generation task, selecting the target large language model to match the generation task, and then generating the target text.
It improves the selection accuracy of large language models and the accuracy of generated text, and avoids the target text quality problems caused by improper model selection.
Smart Images

Figure CN117371428B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to artificial intelligence technologies such as natural language processing, large language models, generative models, etc. A text processing method, device, electronic device, and readable storage medium based on a large language model are provided. Background Art
[0002] Large Language Model (LLM) refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of natural language text. Large language models can handle a variety of natural language tasks, such as text classification, question answering, dialogue, etc., and are an important path to artificial intelligence. With the rapid development of large language models, there are a variety of large language models on the market, which is dazzling. How to select a suitable large language model to process text is an urgent problem to be solved. Summary of the invention
[0003] According to a first aspect of the present disclosure, a text processing method based on a large language model is provided, comprising: obtaining a text to be processed, and determining a target generation task according to the text to be processed; determining a target indicator type according to the target generation task, and obtaining a target indicator value corresponding to the target indicator type for at least one candidate large language model; selecting a target large language model from the at least one candidate large language model according to the target indicator value; and obtaining a target text corresponding to the text to be processed according to the text to be processed and the target large language model.
[0004] According to a second aspect of the present disclosure, a text processing device based on a large language model is provided, comprising: a first processing unit, used to obtain a text to be processed, and determine a target generation task according to the text to be processed; a second processing unit, used to determine a target indicator type according to the target generation task, and obtain a target indicator value corresponding to the target indicator type of the at least one candidate large language model; a selection unit, used to select a target large language model from the at least one candidate large language model according to the target indicator value; and a third processing unit, used to obtain a target text corresponding to the text to be processed according to the text to be processed and the target large language model.
[0005] According to a third aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0006] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method as described above.
[0007] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the method as described above when executed by a processor.
[0008] It can be seen from the above technical solutions that the present disclosure selects a target large language model according to the target generation task corresponding to the text to be processed, so that the target large language model is more matched with the target generation task, and the selection accuracy of the target large language model is improved; and on the basis of the high accuracy of the selected target large language model, the accuracy of the target text obtained according to the target large language model will also be improved accordingly, avoiding the problem of not obtaining the expected target text due to the use of a single large language model or the inability to select a suitable large language model from multiple large language models, thereby improving the accuracy of the generated target text.
[0009] 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
[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0011] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;
[0012] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;
[0013] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;
[0014] Figure 4 It is a block diagram of an electronic device used to implement the text processing method based on a large language model according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0015] 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 and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and mechanisms is omitted in the following description.
[0016] Figure 1 Schematic diagram of the first embodiment of the present disclosure. Figure 1 As shown, the text processing method based on the large language model of this embodiment specifically includes the following steps:
[0017] S101, obtaining a text to be processed, and determining a target generation task according to the text to be processed;
[0018] S102, determining a target indicator type according to the target generation task, and obtaining a target indicator value of the at least one candidate large language model corresponding to the target indicator type;
[0019] S103, selecting a target large language model from the at least one candidate large language model according to the target indicator value;
[0020] S104: Obtain a target text corresponding to the text to be processed according to the text to be processed and the target large language model.
[0021] The text processing method based on the large language model of this embodiment selects a target large language model according to the target generation task corresponding to the text to be processed, so that the target large language model is more matched with the target generation task, thereby improving the selection accuracy of the target large language model; and on the basis of the high accuracy of the selected target large language model, the accuracy of the target text obtained according to the target large language model will also be improved accordingly, avoiding the problem of not obtaining the expected target text due to the use of a single large language model or the inability to select a suitable large language model from multiple large language models, thereby improving the accuracy of the generated target text.
[0022] In this embodiment, when executing S101 to obtain the text to be processed, the text input by the input end may be used as the text to be processed, or the text selected by the input end on the network may be used as the text to be processed.
[0023] The target generation task determined by executing S101 in this embodiment may be one of the generation tasks such as a semantic logic analysis task, a factual question and answer task, a reading comprehension task, a numerical calculation task, a text classification task, a text translation task, a summary extraction task, and a code generation task; different categories of generation tasks are used for the large language model to output text generation results corresponding to different categories of generation tasks according to the input text.
[0024] When executing S101 to determine the target generation task based on the text to be processed, this embodiment can input the text to be processed into a pre-trained task classification model, and use the output result of the task classification model as the target generation task corresponding to the text to be processed; the task classification model can output the generation task corresponding to the text based on the input text.
[0025] This embodiment can obtain the generation task input or selected at the input end while executing S101 to obtain the text to be processed; this embodiment can use the generation task input or selected at the input end as the target generation task corresponding to the text to be processed when executing S101.
[0026] When executing S101 to determine the target generation task according to the text to be processed, this embodiment may also adopt the following method: extracting the starting sentence text and / or the ending sentence text from the text to be processed; and determining the target generation task according to the extracted starting sentence text and / or the ending sentence text.
[0027] When executing S101, this embodiment can input the starting sentence text and / or the ending sentence text into the task classification model, and use the output result of the task classification model as the target generation task corresponding to the text to be processed; or calculate the text similarity between the starting sentence text and / or the ending sentence text and different standard texts (different standard texts correspond to different generation tasks), and use the generation task corresponding to the standard text with the highest text similarity as the target generation task.
[0028] For example, if the text to be processed is "For the following multiple-choice question: Animals have more fat (A) in the ocean (B) in human habitats (C) in landfills (D) in polar regions. Please answer A, B, C, D", this embodiment can use the "factual question and answer task" corresponding to the ending sentence text "Please answer A, B, C, D" as the target generation task when executing S101; if the text to be processed is "Calculate: 30+51=", this embodiment can use the "numerical calculation task" corresponding to the starting sentence text "Calculate" as the target generation task when executing S101.
[0029] When executing S101 in this embodiment, the above three target task determination methods may be respectively executed until a target generation task corresponding to the text to be processed is obtained.
[0030] That is to say, this embodiment can determine the target generation task corresponding to the text to be processed in a variety of ways, avoiding the problem of being unable to determine the target generation task, and can also improve the flexibility in determining the target generation task corresponding to the text to be processed.
[0031] After executing S101 to determine the target generation task according to the text to be processed, this embodiment executes S102 to determine the target indicator type according to the target generation task, and obtains the target indicator value of the target indicator type corresponding to at least one candidate large language model; in this embodiment, different target generation tasks correspond to different target indicator types.
[0032] When executing S102 to determine the target indicator type according to the target generation task, this embodiment can use the indicator type corresponding to the target generation task as the target indicator type based on the preset correspondence between the task and the indicator type; the number of target indicator types determined by executing S102 in this embodiment can be one or more.
[0033] For example, if the target generation task is task A, the target indicator type corresponding to task A may be indicator type 1 or indicator type 2; if the target generation task is task B, the target indicator type corresponding to task B may be indicator type 3; the indicator type in this embodiment may be a similarity indicator, an F1 indicator, a BLEU indicator, etc.
[0034] When executing S102 to obtain a target indicator value of a target indicator type corresponding to at least one candidate large language model, this embodiment can obtain, for each candidate large language model, an indicator value corresponding to the target indicator type from the database as the target indicator value of the target indicator type corresponding to the candidate large language model, that is, this embodiment can pre-store indicator values of different indicator types corresponding to the candidate large language models in the database.
[0035] In this embodiment, the indicator values of different indicator types corresponding to different large language models pre-stored in the database can be updated every day or every week, thereby improving the timeliness of the indicator values.
[0036] When executing S102 to obtain a target indicator value of a target indicator type corresponding to at least one candidate large language model, this embodiment may also adopt the following method: according to the target generation task, select a target test set from at least one test set, the selected target test set containing multiple sample texts and true value texts of the multiple sample texts; input the multiple sample texts into at least one candidate large language model to obtain predicted text output by at least one candidate large language model for each sample text; use an indicator value calculation method corresponding to the target indicator type (different indicator types correspond to different indicator value calculation methods), and obtain the target indicator value of the target indicator type corresponding to at least one candidate large language model according to the true value texts and predicted texts of the multiple sample texts.
[0037] That is to say, this embodiment can obtain the target indicator value of the target indicator type corresponding to the candidate large language model by performing real-time evaluation on the candidate large language model, so that the obtained target indicator value corresponds to the latest version of the candidate large language model, thereby improving the accuracy and timeliness of the obtained target indicator value.
[0038] It is understandable that the above method for obtaining the target indicator value in real time can be used to update the indicator value pre-stored in the database.
[0039] Among them, when this embodiment executes S102 to select a target test set from at least one test set according to the target generation task, it can use the test set corresponding to the target generation task as the target test set according to the preset correspondence between the generation task and the test set, which can improve the accuracy of the selected target test set and further improve the accuracy of the obtained target indicator value.
[0040] In order to improve the evaluation accuracy of the large language model and the controllability of different large language models when outputting results, this embodiment may also include the following contents when executing S102 to input multiple sample texts into at least one candidate large language model: according to the target generation task, obtaining the splicing position (before the sample text, after the sample text, etc.) of the target spliced text and the target spliced text, and different generation tasks correspond to different spliced texts; according to the splicing position, splicing the target spliced text with the multiple sample texts; and inputting the splicing result of the multiple sample texts into at least one candidate large language model.
[0041] For example, if the sample text is "Animals have more fat (A) in the ocean (B) in human habitats (C) in landfills (D) in polar regions", if the spliced text obtained according to the "factual question answering task" is "For the following multiple-choice questions:" (the splicing position is before the sample text) and "Please answer A, B, C, D" (the splicing position is after the sample text), the spliced text is spliced with the sample text, so that "For the following multiple-choice questions: Animals have more fat (A) in the ocean (B) in human habitats (C) in landfills (D) in polar regions. Please answer A, B, C, D" is input as the splicing result into the candidate large language model.
[0042] For example, if the sample text is "What category best describes this paragraph? Group A announced its first quarter 2018 performance with a net profit of RMB 1.5 billion.", if the spliced text obtained according to the "text classification task" is "Options: stories, culture, entertainment, sports, finance, real estate, automobiles, education, technology, military, tourism, international, stocks, agriculture, games. Answer:" (the splicing position is after the sample text), the spliced text is spliced with the sample text, so that "What category best describes this paragraph? Group A announced its first quarter 2018 performance with a net profit of RMB 1.5 billion. Options: stories, culture, entertainment, sports, finance, real estate, automobiles, education, technology, military, tourism, international, stocks, agriculture, games. Answer:" is input into the candidate large language model as the splicing result.
[0043] For specific generation tasks, such as semantic logic analysis tasks, this embodiment can also perform logic reconstruction on the sample text when executing S102 to make the logic of the sample text more fluent, thereby inputting the logic reconstruction result of the sample text into the candidate large language model.
[0044] If multiple target indicator types are determined according to the target generation task, this embodiment will obtain target indicator values corresponding to each target indicator type respectively when executing S102.
[0045] When executing S102, this embodiment can use all large language models that are currently available for open source use as candidate large language models; or, based on the correspondence between preset generation tasks and large language models, use the large language model corresponding to the target generation task as a candidate large language model, thereby improving the selection efficiency of the target large language model.
[0046] In this embodiment, after executing S102 to obtain a target indicator value of a target indicator type corresponding to at least one candidate large language model, executing S103 to select a target large language model from the at least one candidate large language model according to the target indicator value.
[0047] In this embodiment, when executing S103 to select a target large language model from at least one candidate large language model according to the target indicator value, the candidate large language model with the largest target indicator value may be selected as the target large language model.
[0048] If there are multiple target index values, when executing S103, this embodiment can calculate the average index value for each candidate large language model based on multiple target index values, and then use the candidate large language model with the largest average index value as the target large language model.
[0049] It is understandable that if this embodiment executes S103 to determine that there are multiple candidate large language models with the largest target index value or the largest average index value, one of them can be randomly selected as the target large language model.
[0050] After executing S103 to select the target large language model, this embodiment may further select a large language model whose target index value is less than a preset index value threshold from at least one candidate large language model as the large language model to be updated; after completing the selection of the large language model to be updated, this embodiment may send a prompt message to the developer corresponding to the large language model to be updated to prompt the developer to update the large language model, or obtain a target training set corresponding to the target generation task, and then train the large language model to be updated according to the obtained target training set, thereby realizing iterative update of the large language model to be updated.
[0051] That is to say, this embodiment can also determine whether to iteratively update the large language model according to the target indicator value during the actual use of the large language model, thereby improving the accuracy of the large language model in processing different target generation tasks through continuous iterative updates.
[0052] In this embodiment, after executing S103 to select a target large language model from at least one candidate large language model according to the target indicator value, S104 is executed to obtain a target text corresponding to the text to be processed according to the text to be processed and the target large language model.
[0053] When executing S104 in this embodiment, the text to be processed may be input into the target large language model, and the output result of the target large language model is used as the target text corresponding to the text to be processed.
[0054] For example, if the text to be processed is "For the following multiple-choice question: Animals have more fat (A) in the ocean (B) in human homes (C) in landfills (D) in polar regions. Please answer A, B, C, D", the target text obtained by executing S104 in this embodiment may be "Animals have more fat in the "polar regions". The temperature in the polar regions is low, and animals need more fat to maintain their body temperature. The ocean, human homes, and landfills are not the main places for animals to accumulate fat. Therefore, the answer is (D) in the polar regions.".
[0055] For example, if the text to be processed is "What category best describes this paragraph? Group A announced its first quarter 2018 performance with a net profit of RMB 1.5 billion.", the target text obtained by executing S104 in this embodiment may be "Finance. Explanation: Because this paragraph mentions the financial performance of Group A, namely the net profit and the RMB amount, the category that best describes this paragraph is finance.".
[0056] When executing S104 to obtain the target text corresponding to the text to be processed according to the text to be processed and the target large language model, this embodiment can also adopt the following method: according to the target generation task, obtain the splicing position of the target spliced text and the target spliced text (before the sample text, after the sample text, etc.), and different generation tasks correspond to different spliced texts; according to the splicing position, splice the target spliced text with the text to be processed; input the splicing result of the text to be processed into the target large language model, and use the output result of the target large language model as the target text corresponding to the text to be processed.
[0057] That is to say, this embodiment can also optimize the text to be processed according to the target generation task, so that the content in the text to be processed is more complete, thereby improving the accuracy of the target text output by the target large language model.
[0058] It can be understood that when executing S104, this embodiment can also detect whether the text to be processed contains the target spliced text or text similar to the target spliced text. When it is determined that the text to be processed does not contain the target spliced text or text similar to the target spliced text, the step of splicing the target spliced text with the text to be processed is executed, thereby avoiding text duplication and improving the accuracy of text splicing.
[0059] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure. Figure 2 The flowchart of the present embodiment for evaluating at least one candidate large language model when processing text based on a large language model is shown: the test set pool contains test sets corresponding to different generation tasks; the indicator pool contains indicator types corresponding to different generation tasks; the spliced text pool contains spliced texts corresponding to different generation tasks; the model pool contains multiple large language models; the task table contains different evaluation tasks; the case table contains multiple cases, each case contains the type of large language model, sample text input into the large language model, predicted text output by the large language model, and true value text corresponding to the sample text, etc.; the indicator table contains indicator values of the large language model corresponding to different indicator types; S201, obtaining the target generation task ; S202, select a target test set, a target indicator type, a target concatenated text and at least one candidate large language model corresponding to the target generation task; S203, after concatenating the sample text in the target test set with the target concatenated text, input the concatenated result of the sample text into at least one candidate large language model; S204, obtain the predicted text output by at least one candidate large language model for each sample text; S205, according to the target indicator type, the true value text of the sample text and the predicted text of the sample text, obtain the target indicator value of the target indicator type corresponding to at least one candidate large language model; S206, summarize the target indicator values of the target indicator type corresponding to different candidate large language models.
[0060] Figure 3 is a schematic diagram according to the third embodiment of the present disclosure. Figure 3 As shown, the text processing device 300 based on the large language model of this embodiment includes:
[0061] The first processing unit 301 is used to obtain a text to be processed and determine a target generation task according to the text to be processed;
[0062] The second processing unit 302 is used to determine the target indicator type according to the target generation task, and obtain the target indicator value of the at least one candidate large language model corresponding to the target indicator type;
[0063] A selection unit 303 is configured to select a target large language model from the at least one candidate large language model according to the target indicator value;
[0064] The third processing unit 304 is configured to obtain a target text corresponding to the text to be processed according to the text to be processed and the target large language model.
[0065] When the first processing unit 301 obtains the text to be processed, the text input by the input end may be used as the text to be processed, or the text selected by the input end on the network may be used as the text to be processed.
[0066] The target generation task determined by the first processing unit 301 can be one of the generation tasks such as semantic logic analysis task, factual question and answer task, reading comprehension task, numerical calculation task, text classification task, text translation task, summary extraction task, code generation task, etc.; different categories of generation tasks are used for the large language model to output text generation results corresponding to different categories of generation tasks according to the input text.
[0067] When the first processing unit 301 determines the target generation task based on the text to be processed, it can input the text to be processed into a pre-trained task classification model, and use the output result of the task classification model as the target generation task corresponding to the text to be processed; the task classification model can output the generation task corresponding to the text based on the input text.
[0068] The first processing unit 301 can obtain the generation task input or selected at the input end while obtaining the text to be processed; the first processing unit 301 can use the generation task input or selected at the input end as the target generation task corresponding to the text to be processed.
[0069] When determining the target generation task according to the text to be processed, the first processing unit 301 may also adopt the following method: extracting the starting sentence text and / or the ending sentence text from the text to be processed; and determining the target generation task according to the extracted starting sentence text and / or the ending sentence text.
[0070] The first processing unit 301 can input the starting sentence text and / or the ending sentence text into a task classification model, and use the output result of the task classification model as the target generation task corresponding to the text to be processed; it can also calculate the text similarity between the starting sentence text and / or the ending sentence text and different standard texts (different standard texts correspond to different generation tasks), and use the generation task corresponding to the standard text with the highest text similarity as the target generation task.
[0071] The first processing unit 301 may respectively execute the above three target task determination methods until a target generation task corresponding to the text to be processed is obtained.
[0072] That is to say, the first processing unit 301 can determine the target generation task corresponding to the text to be processed in a variety of ways, avoiding the problem of being unable to determine the target generation task, and can also improve the flexibility in determining the target generation task corresponding to the text to be processed.
[0073] In this embodiment, after the first processing unit 301 determines the target generation task according to the text to be processed, the second processing unit 302 determines the target indicator type according to the target generation task, and obtains the target indicator value of the target indicator type corresponding to at least one candidate large language model; in this embodiment, different target generation tasks correspond to different target indicator types.
[0074] When determining the target indicator type according to the target generation task, the second processing unit 302 can use the indicator type corresponding to the target generation task as the target indicator type based on the preset correspondence between the task and the indicator type; the number of target indicator types determined by the second processing unit 302 can be one or more.
[0075] When obtaining the target indicator value of the target indicator type corresponding to at least one candidate large language model, the second processing unit 302 can obtain the indicator value corresponding to the target indicator type from the database for each candidate large language model as the target indicator value of the target indicator type corresponding to the candidate large language model. That is, this embodiment can pre-store the indicator values of the candidate large language models corresponding to different indicator types in the database.
[0076] In this embodiment, the indicator values of different indicator types corresponding to different large language models pre-stored in the database can be updated every day or every week, thereby improving the timeliness of the indicator values.
[0077] When obtaining the target indicator value of the target indicator type corresponding to at least one candidate large language model, the second processing unit 302 may also adopt the following method: according to the target generation task, select a target test set from at least one test set, the selected target test set contains multiple sample texts and true value texts of the multiple sample texts; input the multiple sample texts into at least one candidate large language model to obtain predicted text output by at least one candidate large language model for each sample text; use the indicator value calculation method corresponding to the target indicator type (different indicator types correspond to different indicator value calculation methods), and obtain the target indicator value of the target indicator type corresponding to at least one candidate large language model according to the true value texts and predicted texts of the multiple sample texts.
[0078] That is to say, the second processing unit 302 can obtain the target indicator value of the target indicator type corresponding to the candidate large language model by performing real-time evaluation on the candidate large language model, so that the obtained target indicator value corresponds to the latest version of the candidate large language model, thereby improving the accuracy and timeliness of the obtained target indicator value.
[0079] Among them, when the second processing unit 302 selects a target test set from at least one test set according to the target generation task, it can use the test set corresponding to the target generation task as the target test set according to the preset correspondence between the generation task and the test set, which can improve the accuracy of the selected target test set and further improve the accuracy of the obtained target indicator value.
[0080] In order to improve the evaluation accuracy of the large language model and the controllability of different large language models when outputting results, the second processing unit 302 may also include the following contents when inputting multiple sample texts into at least one candidate large language model: according to the target generation task, obtaining the splicing position of the target spliced text and the target spliced text (before the sample text, after the sample text, etc.), different generation tasks correspond to different spliced texts; according to the splicing position, splicing the target spliced text with the multiple sample texts; and inputting the splicing results of the multiple sample texts into at least one candidate large language model.
[0081] For a specific generation task, such as a semantic logic analysis task, the second processing unit 302 may also perform logic reconstruction on the sample text to make the logic of the sample text more fluent, thereby inputting the logic reconstruction result of the sample text into the candidate large language model.
[0082] If multiple target indicator types are determined according to the target generation task, the second processing unit 302 will respectively obtain the target indicator value corresponding to each target indicator type.
[0083] The second processing unit 302 may use all the large language models that are currently available for open source use as candidate large language models; or, based on the correspondence between the preset generation tasks and the large language models, use the large language model corresponding to the target generation task as a candidate large language model, thereby improving the selection efficiency of the target large language model.
[0084] In this embodiment, after the second processing unit 302 obtains the target indicator value of the target indicator type corresponding to at least one candidate large language model, the selection unit 303 selects a target large language model from the at least one candidate large language model according to the target indicator value.
[0085] When selecting a target large language model from at least one candidate large language model according to the target index value, the selection unit 303 may select a candidate large language model with a maximum target index value as the target large language model.
[0086] If there are multiple target index values, the selection unit 303 may calculate the average index value for each candidate large language model according to the multiple target index values, and then select the candidate large language model with the largest average index value as the target large language model.
[0087] It is understandable that if the selection unit 303 determines that there are multiple candidate large language models with the largest target index value or the largest average index value, one of them can be randomly selected as the target large language model.
[0088] In this embodiment, after the selection unit 303 selects a target large language model from at least one candidate large language model, the third processing unit 304 obtains a target text corresponding to the text to be processed according to the text to be processed and the target large language model.
[0089] The third processing unit 304 may input the text to be processed into the target large language model, and use the output result of the target large language model as the target text corresponding to the text to be processed.
[0090] When the third processing unit 304 obtains the target text corresponding to the text to be processed based on the text to be processed and the target large language model, it can also adopt the following method: according to the target generation task, obtain the splicing position of the target spliced text and the target spliced text (before the sample text, after the sample text, etc.), different generation tasks correspond to different spliced texts; according to the splicing position, splice the target spliced text with the text to be processed; input the splicing result of the text to be processed into the target large language model, and use the output result of the target large language model as the target text corresponding to the text to be processed.
[0091] That is to say, the third processing unit 304 can also optimize the text to be processed according to the target generation task, so that the content in the text to be processed is more complete, thereby improving the accuracy of the target text output by the target large language model.
[0092] It can be understood that the third processing unit 304 can also detect whether the text to be processed contains the target spliced text or text similar to the target spliced text. When it is determined that the text to be processed does not contain the target spliced text or text similar to the target spliced text, the step of splicing the target spliced text with the text to be processed is executed, thereby avoiding text duplication and improving the accuracy of text splicing.
[0093] The text processing device 300 based on the large language model of this embodiment may further include an updating unit 305, which is used to execute: selecting a large language model whose target indicator value is less than a preset indicator value threshold from at least one candidate large language model as the large language model to be updated; after completing the selection of the large language model to be updated, sending a prompt message to the developer corresponding to the large language model to be updated to prompt the developer to update the large language model, or obtaining a target training set corresponding to the target generation task, and training the large language model to be updated according to the obtained target training set, thereby realizing iterative update of the large language model to be updated.
[0094] That is to say, the updating unit 305 can also determine whether to iteratively update the large language model according to the target indicator value during the actual use of the large language model, thereby improving the accuracy of the large language model in processing different target generation tasks through continuous iterative updates.
[0095] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0096] 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.
[0097] like Figure 4 , is a block diagram of an electronic device according to a text processing method based on a large language model according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, 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 processing, 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.
[0098] like Figure 4 As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0099] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0100] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 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 401 performs the various methods and processes described above, such as a text processing method based on a large language model. For example, in some embodiments, a text processing method based on a large language model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408.
[0101] In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the text processing method based on the large language model described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the text processing method based on the large language model in any other appropriate manner (e.g., by means of firmware).
[0102] Various implementations of the systems and techniques described 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), complex 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.
[0103] 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 text processing device based on a large language model, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. 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.
[0104] 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.
[0105] 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 information to the user; and a keyboard and a 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).
[0106] 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 communications network). Examples of communications networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0107] 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 between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server for a distributed system, or a server combined with a blockchain.
[0108] 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.
[0109] 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 spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A text processing method based on a large language model, comprising: Acquire a text to be processed, and determine a target generation task according to the text to be processed, wherein the task type of the target generation task is a text generation task; Determine a target indicator type corresponding to the target generation task according to a preset correspondence between tasks and indicator types, and obtain a target indicator value corresponding to the target indicator type for at least one candidate large language model; Selecting a target large language model from the at least one candidate large language model according to the target indicator value; Obtaining a target text corresponding to the text to be processed according to the text to be processed and the target large language model; Wherein, determining the target generation task according to the to-be-processed text includes: Extracting the starting sentence text and / or the ending sentence text from the text to be processed; The text similarity between the starting sentence text and / or the ending sentence text and different standard texts is calculated, and the generation task corresponding to the standard text with the highest text similarity is used as the target generation task, and different standard texts correspond to different generation tasks.
2. The method according to claim 1, wherein: The obtaining of the target indicator value of the at least one candidate large language model corresponding to the target indicator type comprises: According to the target generation task, a target test set is selected from at least one test set, wherein the target test set includes a plurality of sample texts and true value texts of the plurality of sample texts; Inputting the plurality of sample texts into the at least one candidate large language model to obtain a predicted text output by the at least one candidate large language model for each sample text; Using an indicator value calculation method corresponding to the target indicator type, according to the true value texts and the predicted texts of the multiple sample texts, a target indicator value corresponding to the target indicator type of the at least one candidate large language model is obtained.
3. The method according to claim 2, wherein: The inputting the plurality of sample texts into the at least one candidate large language model comprises: Generate a task according to the target, obtain a target splicing text and a splicing position of the target splicing text; splicing the target splicing text with the multiple sample texts according to the splicing position; The concatenation result of the multiple sample texts is input into the at least one candidate large language model.
4. The method according to claim 1, wherein: The step of obtaining a target text corresponding to the text to be processed according to the text to be processed and the target large language model comprises: Generate a task according to the target, obtain a target splicing text and a splicing position of the target splicing text; splicing the target splicing text with the to-be-processed text according to the splicing position; The concatenation result of the text to be processed is input into the target large language model, and the output result of the target large language model is used as the target text.
5. The method according to claim 1, further comprising: A large language model corresponding to the target generation task is obtained as the at least one candidate large language model.
6. The method according to claim 1, further comprising: Selecting, from the at least one candidate large language model, a candidate large language model whose target index value is less than a preset index value threshold as the large language model to be updated; Generating a task according to the target, selecting a target training set from at least one training set; The large language model to be updated is trained according to the target training set.
7. A text processing device based on a large language model, comprising: A first processing unit is used to obtain a text to be processed, and determine a target generation task according to the text to be processed, wherein the task type of the target generation task is a text generation task; A second processing unit is used to determine a target indicator type corresponding to the target generation task according to a preset correspondence between the task and the indicator type, and obtain a target indicator value corresponding to the target indicator type for at least one candidate large language model; a selection unit, configured to select a target large language model from the at least one candidate large language model according to the target indicator value; A third processing unit, configured to obtain a target text corresponding to the text to be processed according to the text to be processed and the target large language model; Wherein, when the first processing unit determines the target generation task according to the to-be-processed text, it specifically performs: Extracting the starting sentence text and / or the ending sentence text from the text to be processed; The text similarity between the starting sentence text and / or the ending sentence text and different standard texts is calculated, and the generation task corresponding to the standard text with the highest text similarity is used as the target generation task, and different standard texts correspond to different generation tasks.
8. The device according to claim 7, wherein: When obtaining the target indicator value of the target indicator type corresponding to the at least one candidate large language model, the second processing unit specifically performs: According to the target generation task, a target test set is selected from at least one test set, wherein the target test set includes a plurality of sample texts and true value texts of the plurality of sample texts; Inputting the plurality of sample texts into the at least one candidate large language model to obtain a predicted text output by the at least one candidate large language model for each sample text; Using an indicator value calculation method corresponding to the target indicator type, according to the true value texts and the predicted texts of the multiple sample texts, a target indicator value corresponding to the target indicator type of the at least one candidate large language model is obtained.
9. The device according to claim 8, wherein: When the second processing unit inputs the plurality of sample texts into the at least one candidate large language model, specifically: Generate a task according to the target, obtain a target splicing text and a splicing position of the target splicing text; splicing the target splicing text with the multiple sample texts according to the splicing position; The concatenation result of the multiple sample texts is input into the at least one candidate large language model.
10. The device according to claim 7, wherein: When the third processing unit obtains the target text corresponding to the text to be processed according to the text to be processed and the target large language model, the third processing unit specifically performs: Generate a task according to the target, obtain a target splicing text and a splicing position of the target splicing text; splicing the target splicing text with the to-be-processed text according to the splicing position; The concatenation result of the text to be processed is input into the target large language model, and the output result of the target large language model is used as the target text.
11. The apparatus according to claim 7, wherein the second processing unit is further configured to execute: A large language model corresponding to the target generation task is obtained as the at least one candidate large language model.
12. The apparatus according to claim 7, further comprising an updating unit, configured to execute: Selecting, from the at least one candidate large language model, a candidate large language model whose target index value is less than a preset index value threshold as the large language model to be updated; Generating a task according to the target, selecting a target training set from at least one training set; The large language model to be updated is trained according to the target training set.
13. An electronic device, comprising: 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 6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.
15. 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 6.
Citation Information
Patent Citations
Method and device for evaluating prediction models
CN104346372A
Text error correction method and device, electronic equipment and readable storage medium
CN112597754A
Financial text processing method and device, equipment and storage medium
CN116186223A
Model data processing method, related device, equipment and storage medium
CN116629338A