A large model training data processing method, device, medium and equipment
By analyzing the inference process of a large model training dataset, updating the model input to generate training samples that cannot output results, and adjusting the large model through SFT, the "illusion" problem of large language models in the absence of inference conditions is solved, thereby improving the accuracy and reliability of the model.
Patent Information
- Application Number
- CN202511039371.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2045-07-25
AI Technical Summary
Large Language Models (LLMs) suffer from the "illusion" phenomenon of outputting incorrect results during training due to a lack of data or capabilities required for reasoning, which existing methods struggle to address effectively.
By acquiring the training data of a large model as the initial dataset, analyzing the conditions required during the inference process, updating the model input to generate a training dataset that cannot output results, and adjusting the large model through supervised fine-tuning (SFT) to enable it to recognize and respond to the inability to output results.
This effectively avoids large models outputting incorrect results when reasoning conditions are lacking, improves the accuracy and reliability of the model in practical applications, and ensures that the model can recognize that it cannot output the correct answer.
Smart Images

Figure CN120542510B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of computer technology, and particularly relates to a large model training data processing method and device, a storage medium and equipment. BACKGROUND
[0002] With the development of artificial intelligence (AI) technology, large language models (LLMs) have been widely applied in various fields.
[0003] However, LLMs may have problems such as lack of knowledge, knowledge errors, or outdated knowledge due to the limitations of training data. These problems may cause LLMs to have "hallucinations" when performing tasks, thereby reducing the accuracy and reliability of LLMs in performing tasks.
[0004] Therefore, how to avoid LLMs from having "hallucinations" has become a problem to be solved, and thus the present specification provides a large model training data processing method. SUMMARY
[0005] The embodiments of the present specification provide a large model training data processing method, device, storage medium and electronic equipment to partially solve the problems existing in the prior art.
[0006] The embodiments of the present specification adopt the following technical solutions:
[0007] The large model training data processing method provided by the present specification comprises:
[0008] Obtaining training data of a large model as an initial data set, wherein the initial data set contains an inference process of the large model;
[0009] According to the inference process, determining the conditions required for the output results of the large model from the model inputs of the initial data set;
[0010] Updating the conditions determined in the model inputs of the initial data set to obtain a training data set, and determining that the training data set is unable to output results, wherein the training data set is used to fine-tune the large model to be adjusted.
[0011] The large model training data processing device provided by the present specification comprises:
[0012] An obtaining module, configured to obtain training data of a large model as an initial data set, wherein the initial data set contains an inference process of the large model;
[0013] A reasoning module is configured to determine, according to the reasoning process, a condition required for the large model to output the result from the model input of the initial data set;
[0014] A processing module is configured to update the determined condition in the model input of the initial data set to obtain a training data set, and determine that the training data set is labeled as unable to output the result, and the training data set is used to fine-tune the large model to be adjusted.
[0015] The present specification provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the large model training data processing method.
[0016] The present specification provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the large model training data processing method when executing the program.
[0017] The above at least one technical solution adopted by the embodiments of the present specification can achieve the following beneficial effects:
[0018] The embodiments of the present specification disclose a large model training data processing method, which obtains an initial data set containing a reasoning process of a large model, determines, from the reasoning process, a condition required for the large model to output a result in the model input of the initial data set, updates the determined condition in the model input, so that the model input no longer has the condition required for the large model to output the result, obtains a training data set labeled as unable to output the result, and fine-tunes the large model to be adjusted based on the training data set. The method determines the necessary condition for the output result through the reasoning process of the large model, and then updates the corresponding condition in the model input based on this, so that the training sample set no longer has the condition to infer the true output result, thereby training the large model to recognize the ability of the model input without the output result, and avoiding the case that the large model outputs the result with "hallucination". BRIEF DESCRIPTION OF DRAWINGS
[0019] The drawings described herein are used to provide further understanding of the present specification, and form a part of the present specification. The illustrative embodiments of the present specification and their descriptions serve to explain the present specification, and do not constitute an improper limitation on the present specification. In the drawings:
[0020] Figure 1 A large model training data processing flowchart is provided for the embodiments of the present specification;
[0021] Figure 2 A large model training data processing device schematic diagram is provided for the embodiments of the present specification;
[0022] Figure 3 A structural schematic diagram of an electronic device provided for an embodiment of the present specification. DETAILED DESCRIPTION
[0023] For the purpose, technical solutions and advantages of the present specification to be clearer, the technical solutions of the present specification will be described clearly and completely below in combination with specific embodiments of the present specification and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present specification, rather than all the embodiments. Based on the embodiments in the present specification, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the protection scope of the present specification.
[0024] A large language model (LLM), also referred to simply as a large model, is a model that logically infers an input natural language text and outputs a natural language description understandable by a user. Although the LLM can generate content with fluent sentences and strong logic, the output result of the LLM is not always generated based on facts, that is, the case of model hallucination. One of the main reasons for the LLM to produce hallucination is that the LLM requires, in the training process, the LLM to output a fluent sentence and strong logic "answer-looking" output result regardless of right or wrong. That is, whether the model input input into the LLM contains data required to infer the output result or the LLM has the ability to infer the output result, the LLM needs to output "answer-looking" content.
[0025] This leads to the LLM being trained to tend to "speak nonsense seriously, pretend to be wise" and output an incorrect output result regardless of whether a "true answer", that is, a correct output result, can be inferred through the traditional training process. In the actual application of the LLM to perform a business, it is difficult to guarantee whether the LLM has the ability required to perform the business, for example, the ability of network search and the ability to access a certain database, and it is also difficult to guarantee whether the data input into the LLM is sufficient, for example, whether the input question is specific and clear enough. In this case, the training process of the LLM will cause the LLM to output an incorrect result when the LLM cannot infer a correct output result, which is just the LLM appearing "hallucination" and answering the user's input question randomly.
[0026] Existing methods for addressing the "illusion" in LLMs primarily involve attaching an external knowledge base to the LLM or incorporating knowledge into the LLM through supervised fine-tuning (SFT). However, these methods only address factual "illusions," failing to prevent those caused by a lack of data or the necessary reasoning capabilities. For instance, the core function of an external knowledge base is to provide the latest and more accurate factual information. When an LLM answers a factual question, it can retrieve the correct answer from the external knowledge base, thus avoiding factual "illusions" caused by outdated or missing training data. However, when the conditions required for reasoning should themselves come from the model input, external knowledge bases cannot solve the problem. SFT, on the other hand, injects a large amount of new knowledge (usually factual information) into the LLM, aiming to allow the LLM to "remember" this knowledge, enabling it to recall this new memory when answering relevant questions and reducing errors caused by knowledge blind spots. Similarly, the aforementioned non-factual "illusions" cannot be resolved. This is because the "illusions" of LLM caused by the lack of conditions are not due to a lack of factual or common-sense knowledge. Therefore, methods to address the lack of knowledge in LLM are unlikely to be effective.
[0027] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0028] Figure 1 A flowchart illustrating the training data processing of a large model, provided in the embodiments of this specification, specifically includes the following steps:
[0029] S100: Obtain the training data of the large model as the initial dataset, wherein the initial dataset contains the inference process of the large model.
[0030] In the embodiments described in this specification, the following are employed: Figure 1 The device used to process the training data in the method shown can be any electronic device, such as a computer, a server, or a server cluster consisting of multiple servers. For ease of description, the following explanation uses a server as an example only.
[0031] To obtain the ability to train the LLM to identify cases where the self-reasoning process of the LLM leads to the output result appearing "hallucination", the server needs to generate new training samples. It is not necessary to build training samples from scratch, which is costly. The server can first obtain training data for training the LLM from an open source database as an initial data set. The training data in the initial data set includes: model input, output result and reasoning process. The model input is the data input to the LLM. The output result is the reply that the LLM should output for the model input. The reasoning process is the process of the LLM performing logical reasoning based on the model input and determining the final output result. The above training data contains content described in natural language.
[0032] In the embodiments of the present specification, the content obtained by the LLM based on the model input after logical reasoning for reply becomes the output result. The output result includes correct output result and incorrect output result, wherein when the LLM appears "hallucination", the LLM outputs is the incorrect output result. As mentioned above, the present specification aims to solve the incorrect output result that the LLM outputs "looks like an answer", so in the present specification, the incorrect output result is also called pseudo answer, that is, it looks like an answer but actually is not.
[0033] S102: According to the reasoning process, determine the conditions required by the large model to output the result from the model input of the initial data set.
[0034] After the server obtains the initial data set, it can determine for each training data, according to the reasoning process contained in the training data, which content in the model input in the training data is the condition required by the LLM to reason to obtain the output result. That is, which conditions are used by the LLM to reason to obtain the output result. The condition includes data used for reasoning and tools called in reasoning.
[0035] Specifically, first, the server can obtain the reasoning process and model input contained in each training data in the initial data set.
[0036] Then, determine at least one of the data in the model input used by the reasoning process and the tools called in the reasoning process as the condition required by the output result. Since the reasoning process is the process of the LLM obtaining the output result, analyzing the reasoning process can determine which data is applied by the LLM in the process of obtaining the output result, or which tools are called.
[0037] For determining the data used in the model input of the inference process, the server can perform semantic analysis on the text of the inference process to determine the data used in the inference. Since the LLM can also be externally connected to a database or have knowledge injected through SFT, the data used in the inference can be divided into two categories: one is the data contained in the model input, and the other is the data contained in the LLM itself. As mentioned before the embodiments, the problem to be solved in the embodiments of the present specification is the former, because the latter can be solved by externally connecting a database or injecting knowledge through SFT. Therefore, after determining the data required for the LLM inference, the server can further determine the data provided by the model input in the data required for the inference as the condition required for the LLM output result according to the data contained in the model input. For example, when the model input is “What is the weather in Wuhan today?”, it can be determined through the inference process that the data including “geographical location is Wuhan” and “time is today” is used.
[0038] As for the tools called in the inference process, the server can also perform semantic analysis on the text of the inference process to determine the tools called in the inference process. For example, when the model input is “What is the weather in Wuhan today?”, the LLM needs to call a tool for querying external weather data and a tool for querying the date to obtain the actual weather data to give the correct output result. The inference process can include “need to query the weather forecast for the location Wuhan and the time XXXX year X month X day X hour”, “call the time query interface (API)”, “call the preset weather forecast API to obtain the weather information meeting the conditions”, etc. Through semantic analysis, the server can determine that the inference process includes the operations of needing to query and calling the interface, and thus determine that the tools called in the inference process are the time query API and the weather forecast API. Or, when the model input is “XXX+YYY=?” the inference process can include “call the addition calculation API” and “obtain the output result of the addition calculation API”, etc., and the server can also determine the tools called through the inference process.
[0039] In the embodiments of the present specification, the LLM calling tool can be a call to an external business API to obtain corresponding data, or can also be a call to an external knowledge base to obtain data in the knowledge base. Of course, if there is no corresponding business API call provided for the LLM, or the LLM does not have an external knowledge base, obviously the LLM has no ability to obtain the corresponding data. The difference between the calling tool and the required data here is that the required data cannot be obtained by calling. For example, the model input is "is the sales data?" The subject is missing, that is, whose sales data, even if the LLM has the ability to call the sales business API, it cannot implement the correct reasoning process, and can only "talk nonsense". Therefore, the data required by the LLM mentioned in the present specification refers to the data that needs to be carried in the model input, which cannot be determined through other channels and is used for logical reasoning by the LLM. And the tool called by the LLM mentioned in the present specification refers to the ability required by the LLM for logical reasoning on the basis of the necessary data carried in the model input. Therefore, the tool called is not limited in the present specification, for example, in the previous example, whether calling external data or calling a calculation function is the ability required for the LLM to output correct data results. If the LLM cannot call the external weather forecast database, the LLM cannot output the correct weather result, and if the LLM cannot call the addition calculation function, the LLM cannot get the accurate calculation result. Of course, the above addition calculation function is only a straightforward example to indicate that mathematical calculation can be realized by calling an API, and it does not mean that the LLM cannot have the ability to add. The embodiments of the present specification want to illustrate that if the LLM is designed to realize the calculation function by calling the API during construction and training, then the LLM being able to call the API is one of the conditions required for the LLM to output results.
[0040] In addition, in the embodiments of the present specification, the conditions required for the output results determined by the server can include at least one of the data used in the reasoning process and the tools called, and can only have one of them or both, which depends on the actual situation, and the present specification does not limit this.
[0041] And whether it is a tool called in the reasoning process or data in the model input used in the reasoning process, it is a condition determined by the model input. The tool called in the reasoning process, although the tool is not carried in the model input, but the determination to call the tool is determined by the model input. Therefore, it is also referred to as a condition required for the output result determined from the model input in the present specification.
[0042] S104: update the conditions determined in the model input of the initial data set to obtain a training data set, and determine that the labels of the training data set are unable to output results, and the training data set is used to fine-tune the large model to be adjusted.
[0043] In the embodiments of the present specification, after determining the conditions required by the large model to output results in each training data in the initial data, in order to train the LLM to autonomously analyze the residual of the data and the called tool, and identify the ability of itself to infer the correct output result, the server can update the model input of the training data in the initial data set to obtain a training data set, and determine that the labels of the training data in the training data set are unable to output results. Then the training data set can be used to SFT the LLM to be adjusted, so that the LLM to be adjusted has the ability to analyze the residual in the inference process, determine whether itself can output the correct output result, and if it cannot output the "correct output result", output the reply of "unable to output result". Avoid the situation that the LLM "pretends to know" without having the ability to infer the correct answer, and reduce the possibility of "hallucination" of the output result of the LLM.
[0044] Specifically, the server can first determine, for each training data, the data in the model input of the training data that belongs to the conditions required for output results.
[0045] Then, the server can modify or delete the determined data in the model input to obtain updated training data as training samples in the training data set. Then the training samples in the training data set lack the necessary data required for LLM inference, and then the LLM should not be able to infer the correct answer based on the training samples. With such a training data set, SFT the LLM, if the LLM still outputs the output result that "looks like an answer", instead of the output result for informing the user that "it is unable to output results", the parameters of the LLM can be adjusted through supervised training to enable the LLM to "learn" how to output "unable to output results" when the necessary conditions for inference are lacking.
[0046] For example, the training data in the initial data set is "What is the weather in Wuhan today?", and the conditions required for the LLM to output the result are determined by step S102 to include location data "Wuhan", time data "today", query target "weather", calling date API, and calling weather forecast API. The server can delete the location data in it, and obtain the training sample "What is the weather today?", or delete the query target, and obtain the training sample "What is Wuhan today?". The former lacks necessary location information, and the latter lacks necessary questioning purposes, which changes the question into an open question, so that the original intention of the user in the training sample is no longer clear, that is, the question is not specific enough. The usual LLM will give an "answer-like" output result, which is obviously not the answer corresponding to the original intention of the user, and the output result cannot be obtained through labeling, so that after fine-tuning the LLM, the LLM can clearly reply that it cannot give the correct answer.
[0047] Alternatively, the server can also modify or delete the content in the model input that needs to be called according to the list of tools that can be called by the LLM to be adjusted according to the determined conditions. For example, the LLM can call the weather API, but cannot call the traffic flow API, so the model input is modified from "What is the weather in Wuhan today?" to "What is the traffic in Wuhan today?", or the content is deleted to become "What is Wuhan today?", achieving the effect that the LLM cannot output the correct output result due to lack of necessary information.
[0048] Of course, in the present specification, it is not limited to only deleting data in the model input, but also changing, but the server needs to determine the data type of the change target, and use different data types as the changed data. That is, the original model input is modified so that the model input no longer has data that the LLM can reason to output the correct output result. For example, the training data is "What is the weather in Wuhan today?", and the location data is modified to "sun" or the query target "weather" is modified to the number "100", and a training sample with similar effect to deleting data can also be obtained.
[0049] Based on Figure 1The training data processing method of the large model is shown. The method obtains an initial data set containing the inference process of the large model, determines the conditions required by the large model to infer the output results in the model input of the initial data set from the inference process, and updates the determined conditions in the model input, so that the model input no longer has the conditions required by the large model to output results. Obtain a training data set labeled as unable to output results, and fine-tune the large model to be adjusted based on the training data set. The method determines the conditions required for the output results through the inference process of the large model, and then updates the corresponding conditions in the model input based on this, so that the training sample set no longer has the conditions to infer the true output results. Therefore, the large model can recognize the ability of the model input without output results, and avoid the situation that the large model outputs "illusion" results.
[0050] Through the training samples in the training data set that cannot infer the correct output results, SFT is performed on the LLM with the label of unable to output results. Therefore, the LLM needs to judge at each step in the inference process. Whether the required data or the tools to be called exist, if the data does not exist, it can be determined that the correct output result cannot be given, or if the tool to be called is not in the callable tools, it can also be determined that the correct output result cannot be given. According to the label output of the training sample in SFT, the output result cannot be output. Avoid the situation that the LLM directly outputs a pseudo answer when it cannot infer the correct output result. In some scenarios, users may not have the ability to distinguish whether the output result of the LLM is correct, and therefore may be misled by the pseudo answer output by the LLM. The LLM fine-tuned by the training data set provided in the specification can directly reply to the user that it cannot give an answer, so the user can intuitively determine that the LLM cannot give a correct answer, rather than being misled by the pseudo answer given by the LLM.
[0051] In the embodiments of the present specification, in the training data obtained by the server in step S100, if the inference process is not included, the server can input the model input in the training data into the trained general LLM, and obtain the inference process of the LLM added to the training data. Wherein, the LLM can be pre-deployed on the server, of course, it can also be deployed on other devices, if it is deployed on other devices, the server can send the business logic process to other devices, so that other devices input the received business logic process into the LLM. The general LLM can be an open source model or a pre-trained model, which is not limited in the present specification. It should be noted that in the embodiments of the present specification, the LLM that gives the inference process of the training data and the subsequent LLM to be adjusted can be the same LLM, or can be different LLMs. The server for processing the training data and the server for subsequent SFT of the LLM to be adjusted based on the training sample can also be the same device. Alternatively, different devices can also be used, which is not limited in the present specification, and can be set as needed.
[0052] In the embodiments of the present specification, when the server determines the data in the model input used in the inference process in step S102, the inference process can be first split, and then analyzed step by step, so as to avoid the situation that the text of the entire inference process is analyzed with errors and omissions.
[0053] Specifically, first, the inference process contained in the training data is split to determine each inference step in the inference process. The server can use mature semantic analysis or sentence analysis method to split the inference process. Because the inference process of the LLM is a step-by-step process, there is obviously an inference step and a logical relationship between steps. In the embodiments of the present specification, the server can not pay attention to the logical relationship between the inference steps, but further analyze the step content.
[0054] Therefore, the server can match each inference step with the model input in the training data to determine whether the inference step uses the data contained in the model input. Specifically, if a certain inference step needs to be based on the data contained in the model input, the description text of the inference step must contain the "name" of the data, so the server can simply perform keyword matching to determine whether the inference step uses the data contained in the model input.
[0055] For example, the model input is processed by word segmentation, and keyword matching is performed according to the entities obtained by word segmentation. Or the server can also use other LLMs for matching judgment, such as inputting "whether the inference step a uses the data in the model input b" into other LLMs, and determining whether the data contained in the model input is used according to the output result of the other LLMs.
[0056] If yes, it is determined that the data matched in the model input is one of the conditions required for the output result. In this specification, it does not matter which step uses the data in the model input, but it matters which data is used, so as long as any step uses the data. Of course, in order to save costs, the server can not make a judgment based on the data when determining that the data in the model input is one of the conditions required for the LLM output result, and subsequent other reasoning steps make judgments.
[0057] If no, it is determined that the data contained in the model input is not required for the reasoning step. And continue to judge other reasoning steps until all reasoning steps are judged, and determine the data in the model input for reasoning as one of the conditions required for the LLM output result.
[0058] In addition, in this specification, the server also needs to determine the tools called by the LLM output result, because the tools that can be called by different LLMs are not exactly the same, that is, the capabilities of LLMs are different. Determining the tools called by the LLM when outputting the result can also determine whether the training data can be treated as a training sample for the LLM to be adjusted. For example, it is determined that the LLM calls a weather API when reasoning based on the training data M, and the LLM to be adjusted does not have the ability to call the weather API. Then the training data can also be used as a training sample for SFT of the LLM to be adjusted.
[0059] Specifically, first, the reasoning process contained in the training data is split to determine each reasoning step in the reasoning process. This step is similar to the foregoing process, and this specification will not be repeated.
[0060] After that, the server can perform semantic analysis on each reasoning step to determine whether the reasoning step calls an interface. Here, mature semantic analysis methods can be used to determine whether the reasoning step calls an API and what kind of API is called.
[0061] If yes, it is determined that the function corresponding to the called interface is one of the conditions required for the output result.
[0062] If no, it is determined that the reasoning step does not call a tool.
[0063] Further, in the embodiments of the present specification, the data used for the inference process and the processing manner of the called tool are different. For the used data, the training sample can be obtained by updating the data used in the training data. For the called tool, the tool that can be called by the LLM to be adjusted is determined after the LLM to be adjusted is determined. Then, the training sample is obtained by using the tool that can be called by the LLM to be adjusted and does not contain the training data of the tool called by the inference process. That is, even if the training data is not changed and is directly input into the LLM to be adjusted, the LLM to be adjusted cannot obtain the correct output result because the tool that can be called by the LLM to be adjusted does not contain the tool that needs to be called by the inference process, and the SFT is performed based on the result.
[0064] In the embodiments of the present specification, the above training data processing process is based on that the training data in the initial data set is complete and cannot cause the LLM to produce "hallucination". However, in actual situations, even if the database is open source or the data set is mature, it cannot be guaranteed that all training data will not cause "hallucination" on any LLM. The server can also analyze the inference process in the training data, determine the conditions that should be used for the inference process, and compare the conditions used for the inference process. If they are inconsistent, it means that the result output by the LLM based on the training data has "hallucination", and the training data is directly used as a training sample for SFT. If they are consistent, the adjustment is performed again through step S106 to obtain the training sample.
[0065] Specifically, for each training data, the server can perform context analysis on the inference process contained in the training data to determine the data required in the inference process and the tool required to be called. Here, the text of the inference process is not analyzed semantically, but the conditions required to implement the inference process are determined in combination with the context of the inference process.
[0066] For example, the model input is "How is Wuhan today?", and the inference process is "determine the time and object of the user's question as today and Wuhan, respectively, and determine the purpose of the question. The purpose of the question is not clear, and the user may want to travel. How should I answer the user...". Through the context of the inference process, it can be determined that the data required for inference is the query target, which is not contained in the model input.
[0067] Afterwards, according to the model input contained in the training data, the tool that can be called by the large model to be adjusted, the data needed in the inference process and the tool that needs to be called, it is judged whether the large model to be adjusted can output the result. Specifically, according to the data in the model input contained in the training data and the data needed in the inference process, it is judged whether the needed data is contained in the model input. And according to the tool that can be called by the large model to be adjusted and the tool that needs to be called, it is judged whether the tool that needs to be called can be called by the large model to be adjusted.
[0068] If any of the above is false, it means that the training data does not naturally have the condition to make the large model to be adjusted output the correct output result, so the training data can be directly used as a training sample. Specifically, if the model input contained in the training data is inconsistent with the data needed in the inference process, or the tool that can be called by the large model to be adjusted does not support the tool that needs to be called in the inference process, the training data is used as a training sample in the training data set.
[0069] If yes, it means that the large model to be adjusted can output the correct output result according to the model input, so the training data needs to be modified or deleted by step S106. Specifically, the data matched in the model input is modified or deleted.
[0070] In this specification, after obtaining the training sample, the server can use the training sample to perform SFT on the LLM. Specifically, first, the server can input the model input in the training data set into the large model to be adjusted.
[0071] When the large model to be adjusted outputs an incorrect output result, that is, outputs a pseudo answer instead of outputting a reply of "unable to output result", the large model to be adjusted is supervised fine-tuning trained for lacking conditions needed for inference.
[0072] Of course, if the large model to be adjusted outputs a reply of "unable to output result", the large model to be adjusted can not be SFT. This SFT process is equivalent to training the LLM to perform residual analysis in the inference process, that is, the residual between what the LLM can do and what is needed in the inference process, to learn the ability of self-cognition, and determine whether the correct output result can be output.
[0073] Further, in the embodiment of the present specification, in addition to enabling the LLM to identify "hallucination" by itself, in order to improve the ability of the LLM to further process the problem after "hallucination" may occur. The server can also use the conditions updated in step S106 as one of the labels when generating training samples.
[0074] Then, the fine-tuned LLM can not only identify that it cannot reason out the correct output result, but also determine why it cannot reason out the correct output result, and return as a reply.
[0075] For example, the model input input by the user is "How is Wuhan today?" The LLM identifies the lack of query target and replies to the user "Cannot output the result because it does not know what you want to ask about Wuhan today. What specific content do you want to ask about?"
[0076] The above is a large model-based query sentence generation method provided by an embodiment of the present specification. Based on the same idea, the present specification also provides a corresponding device, a storage medium, and an electronic device.
[0077] Figure 2 A large model-based query sentence generation device provided by an embodiment of the present specification is shown in the schematic diagram. The device comprises:
[0078] The acquisition module 201 is configured to acquire training data of a large model as an initial data set, wherein the initial data set contains an inference process of the large model.
[0079] The condition determination module 202 is configured to determine, according to the inference process, a condition required for the output result of the large model from the model input of the initial data set.
[0080] The processing module 203 is configured to update the condition determined in the model input of the initial data set to obtain a training data set, and determine that the training data set is labeled as unable to output the result, wherein the training data set is used to fine-tune the large model to be adjusted.
[0081] Optionally, the condition determination module 202 is configured to, for each training data in the initial data set, acquire the inference process and the model input contained in the training data; determine at least one of the data in the model input used by the inference process and the tool called in the inference process as a condition required for the output result.
[0082] Optionally, the condition determination module 202 is configured to split the inference process contained in the training data to determine each inference step in the inference process; for each inference step, match the inference step with the model input in the training data to determine whether the inference step uses the data contained in the model input; if so, determine the matched data in the model input as one of the conditions required for the output result.
[0083] Optionally, the condition determining module 202 is configured to split the inference process contained in the training data, determine each inference step in the inference process; for each inference step, perform semantic analysis on the inference step, determine whether the inference step calls an interface; if yes, determine the function corresponding to the called interface as one of the conditions required for the output result.
[0084] Optionally, the processing module 203 is configured to, for each training data, determine the data in the model input of the training data that belongs to the condition required for the output result; modify or delete the determined data to obtain updated training data as a training sample in the training data set.
[0085] Optionally, the processing module 203 is configured to perform context analysis on the inference process contained in the training data, determine the data required in the inference process and the tools required to be called; determine whether the large model to be adjusted can output the result according to the model input contained in the training data, the tools callable by the large model to be adjusted, the data required in the inference process and the tools required to be called; if yes, modify or delete the determined data.
[0086] Optionally, the processing module 203 is further configured to determine that the model input contained in the training data is inconsistent with the data required in the inference process, or the tools callable by the large model to be adjusted do not support the tools required to be called in the inference process, and then take the training data as a training sample in the training data set.
[0087] Optionally, the processing module 203 is further configured to determine the label of the training sample in the training data set according to the updated condition and the inability to output the result, and the training data set is used to fine-tune the large model to be adjusted, so that the large model to be adjusted after fine-tuning outputs the conditions lacking in inference.
[0088] Optionally, the apparatus further comprises:
[0089] The training module 204 is configured to input the model input in the training data set into the large model to be adjusted; when the large model to be adjusted outputs an incorrect output result, perform supervised fine-tuning training on the large model to be adjusted for the conditions lacking in inference required by the large model to be adjusted.
[0090] The present specification also provides a computer readable storage medium, the storage medium stores a computer program, the computer program is executed by a processor and can be used to execute the large model training data processing method provided above.
[0091] Based on Figure 1The training data processing method of the large model shown in the specification also provides Figure 3 The structural diagram of the electronic device shown. As Figure 3 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and of course can also include other hardware required by the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs to implement the large model training data processing method described above.
[0092] The above is only an embodiment of the specification and is not intended to limit the specification. Various changes and modifications can be made to the specification by those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the specification shall be included in the scope of the claims of the specification.
Claims
1. A method for processing training data of a large model, the method comprising: obtaining training data of a large model as an initial data set, the initial data set containing inference processes of the large model; for each training data in the initial data set, obtaining an inference process contained in the training data and a model input; analyzing the inference process to identify conditions required by the large model for inferring an output result from the model input, the conditions including data used from the model input and / or tools called in the inference process, the data including text data, and the tools including at least one of an external business API or an externally plugged-in knowledge base; modifying or deleting the conditions determined in the model input of the initial data set, constructing updated training data such that the large model cannot derive the original output result based on the updated training data, labeling the updated training data as unable to output a result, obtaining a training data set, and determining that the training data set is labeled as unable to output a result, the training data set being used to fine-tune a large model to be adjusted to train the large model to be adjusted to recognize its lack of output conditions and respond to the inability to output a result.
2. The method of claim 1, wherein determining the data used from the model input in the inference process comprises: splitting the inference process contained in the training data to determine each inference step in the inference process; for each inference step, matching the inference step with the model input in the training data to determine whether the inference step uses data contained in the model input; and if so, determining the matched data in the model input as one of the conditions required for the output result.
3. The method of claim 1, wherein determining the tools called in the inference process comprises: splitting the inference process contained in the training data to determine each inference step in the inference process; for each inference step, performing semantic analysis on the inference step to determine whether the inference step calls an interface; and if so, determining a function corresponding to the called interface as one of the conditions required for the output result.
4. The method of claim 1, wherein updating the conditions determined in the model input of the initial data set comprises: for each training data, determining data in the model input of the training data that belongs to the conditions required for the output result; and modifying or deleting the determined data to obtain updated training data as a training sample in the training data set.
5. The method of claim 1, wherein modifying or deleting the determined data comprises: performing context analysis on the inference process contained in the training data to determine data required in the inference process and tools required to be called; determining whether the large model to be adjusted can output a result based on the model input contained in the training data, tools callable by the large model to be adjusted, data required in the inference process, and tools required to be called in the inference process; and if so, modifying or deleting the determined data. 6. The method of claim 5, further comprising: determining that the model input contained in the training data is inconsistent with the data required in the inference process, or the tool that the large model to be adjusted can call does not support the tool required to be called in the inference process, and then regarding the training data as a training sample in the training data set.
7. The method of claim 1, wherein determining that the label of the training data set is unable to output a result comprises: determining the label of the training sample in the training data set according to the updated condition and the inability to output a result, the training data set being used to fine-tune the large model to be adjusted to enable the large model to be adjusted to output the condition lacking in inference.
8. The method of claim 1, wherein fine-tuning the large model to be adjusted using the training data set comprises: inputting the model input in the training data set into the large model to be adjusted; and when the large model to be adjusted outputs an incorrect output result, performing supervised fine-tuning training on the large model to be adjusted in response to the condition lacking in inference.
9. A device for processing training data of a large model, the device comprising: an acquisition module configured to acquire training data of a large model as an initial data set, the initial data set containing an inference process of the large model; an inference module configured to, for each training data in the initial data set, acquire an inference process and a model input contained in the training data, analyze the inference process to identify a condition required for the large model to infer an output result from the model input, the condition including data used from the model input and / or a tool called in the inference process, the data including text data, and the tool including at least one of an external business API or an externally plugged-in knowledge base; a processing module configured to modify or delete the condition identified in the model input of the initial data set, construct updated training data, so that the large model cannot obtain the original output result based on the updated training data, label the updated training data as unable to output a result, obtain a training data set, and determine that the label of the training data set is unable to output a result, the training data set being used to fine-tune a large model to be adjusted to train the large model to be adjusted to recognize its own lack of output conditions and respond to the inability to output a result.
10. A computer-readable storage medium storing a computer program, the computer program being executed by a processor to implement the method of any one of claims 1-8.
11. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the method of any one of claims 1-8 when executing the program.
Citation Information
Patent Citations
Big language model illusion relieving scheme based on citation correction
CN117910449A