Natural language inference method, device and equipment based on inference path
By extracting and labeling inference path samples from the model training set, a second language model suitable for the target task is trained, which solves the problem of low utilization of language models in different inference scenarios and improves the inference effect and accuracy of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2023-04-23
- Publication Date
- 2026-07-03
AI Technical Summary
Different reasoning scenarios require different language models, resulting in low utilization of each language model. Furthermore, when encountering multi-step reasoning situations, the hints added during the pre-training stage cannot guide the model to learn effective content, leading to poor model reasoning performance and low accuracy.
In the model training set corresponding to the target task, a preset number of target samples are extracted, and the samples are labeled with inference paths. The labeled target samples are added to the model training set. The first language model is trained using the sample data in the model training set to obtain the second language model. The target task data is then input into the second language model for language recognition to obtain the inference result.
By training the model to simulate the human thought process, the model's reasoning performance and accuracy on new problems are improved, making it suitable for various reasoning scenarios.
Smart Images

Figure CN116596073B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of Internet technology and language models, and in particular to a natural language reasoning method, apparatus and device based on reasoning path. Background Technology
[0002] With the continuous advancement of technology, people often use applications to solve problems in their daily lives, such as using mobile phone voice assistants to set schedule reminders or using medical service applications to inquire about medical conditions. These application scenarios all require the use of language models for semantic reasoning.
[0003] In related technologies, the e-SNLI model is used for semantic natural language reasoning, the STaR model is used for common sense reasoning, and the "training validator" scheme is used to solve arithmetic reasoning. Furthermore, in the pre-training stage of the model, cues are added to the samples to guide the output direction of the model.
[0004] In the process of developing this application, the applicant discovered that the relevant technology has at least the following problems:
[0005] Different reasoning scenarios require different language models, resulting in low utilization of each language model. Furthermore, when encountering multi-step reasoning situations, the hints added during the pre-training stage cannot guide the model to learn effective content, leading to poor model reasoning performance and low accuracy. Summary of the Invention
[0006] In view of this, this application provides a natural language reasoning method, apparatus, computer device and computer-readable storage medium based on reasoning path. The main purpose is to solve the problems that different reasoning scenarios require different language models, resulting in low utilization of each language model. Furthermore, when encountering multi-step reasoning, the hints added during the pre-training stage cannot guide the model to learn effective content, leading to poor model reasoning performance and low accuracy.
[0007] According to a first aspect of this application, a natural language reasoning method based on reasoning paths is provided, the method comprising:
[0008] In the model training set corresponding to the target task, a predetermined number of target samples are extracted;
[0009] The target samples are labeled with inference paths, and the labeled target samples are added to the model training set.
[0010] Using the sample data in the model training set, the first language model is trained to obtain the second language model, where the first language model is the basic language model.
[0011] Obtain target task data, input the target task data into the second language model for language recognition, and obtain the inference result output by the second language model.
[0012] According to a second aspect of this application, a natural language reasoning device based on reasoning paths is provided, the device comprising:
[0013] The extraction module is used to extract a preset number of target samples from the model training set corresponding to the target task.
[0014] The transmission module is used to label the inference path of the target sample and add the labeled target sample to the model training set.
[0015] The training module is used to train the first language model using sample data from the model training set to obtain the second language model, wherein the first language model is the base language model.
[0016] The acquisition module is used to acquire target task data, input the target task data into the second language model for language recognition, and obtain the inference result output by the second language model.
[0017] According to a third aspect of this application, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any of the first aspects above.
[0018] According to a fourth aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of the first aspects above.
[0019] By employing the above technical solution, this application provides a natural language reasoning method, apparatus, computer device, and computer-readable storage medium based on reasoning paths. First, a predetermined number of target samples are extracted from the model training set corresponding to the target task. Then, reasoning paths are labeled on the target samples, and the labeled target samples are added to the model training set. Next, the first language model is trained using sample data from the model training set to obtain a second language model, with the first language model serving as the base language model. Finally, target task data is obtained and input into the second language model for language recognition, yielding the reasoning result output by the second language model. By adding reasoning path labels to some target samples in the model training set to simulate the human thought process, the model can mimic the entire reasoning calculation process in new problems and obtain the correct answer, thereby improving the effectiveness and accuracy of the model's reasoning.
[0020] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description
[0021] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0022] Figure 1 A schematic diagram of a natural language reasoning method based on reasoning path provided in an embodiment of this application is shown;
[0023] Figure 2A A schematic diagram of a natural language reasoning method based on reasoning path provided in an embodiment of this application is shown;
[0024] Figure 2B A schematic diagram of a natural language reasoning method based on reasoning path provided in an embodiment of this application is shown;
[0025] Figure 3A A schematic diagram of the structure of a natural language reasoning device based on reasoning path provided in an embodiment of this application is shown;
[0026] Figure 3B A schematic diagram of the structure of a natural language reasoning device based on reasoning path provided in an embodiment of this application is shown;
[0027] Figure 3C A schematic diagram of the structure of a natural language reasoning device based on reasoning path provided in an embodiment of this application is shown;
[0028] Figure 4 A schematic diagram of the device structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0029] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0030] This application provides a natural language reasoning method based on reasoning paths, such as... Figure 1As shown, the method includes:
[0031] 101. Extract a predetermined number of target samples from the model training set corresponding to the target task.
[0032] In this embodiment, when the most basic language model is applied to a specific downstream task, a prompt suitable for the current task needs to be added. The prompt accompanies the input, providing context to the model and guiding it on the next task; it is a hint. In other words, it can transform the downstream task into what the pre-trained model expects. This application considers that each downstream task scenario uses text data from the current scenario as the model training set when adaptively training the basic language model. Therefore, after selecting a task as the target task, the system extracts a preset number of target samples from the model training set corresponding to that target task—samples that need to be labeled with inference paths. It should be noted that the preset number can be a system default value or set by relevant personnel according to actual conditions; this application does not specifically limit the value or setting method of the preset number.
[0033] 102. Label the inference path for the target sample and add the labeled target sample to the model training set.
[0034] In this embodiment, the system adds inference path annotations to the target samples and re-adds the annotated target samples as high-quality samples back to the model training set. During actual operation, the system can send an annotation window to the target terminal, where relevant personnel annotate the target samples using the annotation window. After annotation, the relevant personnel can trigger a confirmation command. In response to detecting the confirmation command, the system receives the inference path input by the relevant personnel and annotates the target samples using the inference path. Compared to real samples, using high-quality samples can train a better model. However, considering the annotation cost of high-quality annotated data, this application only annotates a preset number of target samples.
[0035] 103. Using the sample data in the model training set, train the first language model to obtain the second language model. The first language model is the basic language model.
[0036] In this embodiment, a training set with high-quality samples is input into a first language model for training to obtain a second language model suitable for the target task. The first language model is a base language model, which can be a LaMDA model, a GPT-3 model, a PaLM model, etc.
[0037] 104. Obtain the target task data, input the target task data into the second language model for language recognition, and obtain the inference results output by the second language model.
[0038] In this embodiment, after obtaining a second language model applicable to the target task, a specific reasoning task can be performed within the target task scenario. Specifically, target task data is acquired, input into the second language model, and the second language model outputs its reasoning result to obtain the answer corresponding to the target task data.
[0039] The method provided in this application first extracts a preset number of target samples from the model training set corresponding to the target task. Then, it annotates the target samples with inference paths and adds the annotated target samples to the model training set. Next, it uses the sample data from the model training set to train a first language model, obtaining a second language model, with the first language model serving as the base language model. Finally, it acquires the target task data, inputs it into the second language model for language recognition, and obtains the inference result output by the second language model. By adding inference path annotations to some target samples in the model training set to simulate the human thought process, the model can mimic the entire inference calculation process on new questions and obtain the correct answer, thereby improving the effectiveness and accuracy of the model's inference.
[0040] This application provides a natural language reasoning method based on reasoning paths, such as... Figure 2A As shown, the method includes:
[0041] 201. Collect text data from multiple data sources, construct a first language model based on the text data, and apply the first language model to the target task.
[0042] With the continuous advancement of technology, people frequently use applications to solve everyday problems, such as setting schedule reminders using mobile voice assistants or checking medical conditions using medical service applications. These applications all require language models for semantic reasoning. Currently, e-SNLI models are used for natural language semantic reasoning, STaR models for common sense reasoning, and a "training validator" approach for arithmetic reasoning. Furthermore, during the model's pre-training phase, hints are added to samples to guide the model's output direction. However, the applicant recognizes that different reasoning scenarios require different language models, resulting in low utilization of each model. Moreover, in multi-step reasoning scenarios, the hints added during pre-training cannot guide the model to learn effective content, leading to poor model reasoning performance and low accuracy.
[0043] This application employs a prompt scheme based on a cutting-edge NLP framework to annotate inference paths. A prompt refers to adding a "hint" text before the input of a large-scale pre-trained model to guide the model's output direction. The advantage of this is that the model can incorporate more task data during pre-training and can be larger in scale, resulting in a more general-purpose pre-trained model. Furthermore, due to the large model size, the same purpose can be achieved in downstream tasks simply by introducing the prompt without further fine-tuning. However, existing standard prompt schemes do not produce ideal results when facing complex reasoning problems, indicating that standard prompt content cannot directly inspire the solution logic for mathematical problems and common-sense reasoning problems.
[0044] Therefore, this application provides a natural language reasoning method, apparatus, computer device, and computer-readable storage medium based on reasoning paths. First, a predetermined number of target samples are extracted from the model training set corresponding to the target task. Then, reasoning paths are labeled on the target samples, and the labeled target samples are added to the model training set. Next, the first language model is trained using sample data from the model training set to obtain a second language model, with the first language model serving as the base language model. Finally, target task data is obtained and input into the second language model for language recognition, yielding the reasoning result output by the second language model. By adding reasoning path labels to some target samples in the model training set to simulate the human thought process, the model can mimic the entire reasoning calculation process in new problems and obtain the correct answer, thereby improving the effectiveness and accuracy of the model's reasoning.
[0045] In this embodiment, a basic language model is trained by integrating downstream task data. After the language model is built, prompts are used to apply it to different downstream tasks, such as text classification and text generation. Different prompts guide the model to determine the type of problem to solve next.
[0046] Specifically, this application acquires a large amount of text data from multiple application scenarios to construct a basic language model, namely the first language model. First, the system collects text data from multiple data sources, numbers the text data, and extracts text data with target numbers as training data. The target numbers can be any value. For example, if there are 10 text data points, they can be numbered from 1 to 10. With a preset number of 3, three random target number values are generated: 2, 5, and 9. Text data with numbers 2, 5, and 9 are extracted as target samples. Next, the remaining text data is used as test data. Further, a basic model is defined, trained using the training data, and tested using the test data.
[0047] In actual operation, the system can extract multiple training data sets in batches to train the base model. After training, test data is used to test the base model and determine the test results. When the test results meet preset conditions, the first language model is obtained. In practice, the preset conditions can be accuracy thresholds. Based on the test results, the prediction accuracy of the base model is determined, and this accuracy is compared with the accuracy threshold corresponding to the preset conditions. When the prediction accuracy is greater than or equal to the accuracy threshold corresponding to the preset conditions, the first language model is obtained. When the prediction accuracy is less than the accuracy threshold corresponding to the preset conditions, text data is re-acquired to train the base model until the final test results meet the preset conditions, thus obtaining the first language model.
[0048] 202. Extract a predetermined number of target samples from the model training set corresponding to the target task.
[0049] In this embodiment, when the most basic language model is applied to a specific downstream task, a prompt message applicable to the current task needs to be added. This application considers that each downstream task scenario uses text data from the current scenario as the model training set when adaptively training the basic language model. Therefore, after selecting a task as the target task, the system extracts a preset number of target samples from the model training set corresponding to that target task; these are the samples that need to be labeled with inference paths. It should be noted that the preset number can be a system default value or can be set by relevant personnel according to actual conditions. This application does not specifically limit the value or setting method of the preset number.
[0050] 203. Label the inference path for the target sample and add the labeled target sample to the model training set.
[0051] In this embodiment, considering that the current standard Prompt scheme cannot guide the model to learn the numerical calculation logic, resulting in poor model prediction performance and often incorrect answers to real reasoning problems, this application adopts inference path annotation. The specific annotation process is as follows:
[0052] First, sample data is extracted from different example sets in the model training set to obtain a predetermined number of target samples. Common example sets include mathematical calculation problems (fill-in-the-blank), mathematical calculation problems (multiple choice), common sense reasoning problems (multiple choice), common sense reasoning problems (judgment), and common sense reasoning problems (date), etc.
[0053] Furthermore, for each target sample in a preset number of target samples, the target sample is identified, and its inference path is determined. Specifically, based on natural language processing technology, the sample result corresponding to the target sample is determined. Based on the sample result, the inference process corresponding to the target sample is determined, such as... Figure 2BAs shown, the multiple reasoning steps indicated by the reasoning process are used as the reasoning path. The reasoning process is used to describe the steps taken by the target sample to obtain the sample result. For example, a math calculation problem (fill in the blank): Xiaoming has 5 tennis balls. He bought 3 boxes, each box containing 4 tennis balls. How many tennis balls does he have now? (Correct answer: Originally 5, 3 boxes of new ones, each box containing 4 tennis balls, 3 x 4 = 12, total 5 + 3 x 4 = 17). A math calculation problem (multiple choice): Q: How many keystrokes are needed to input numbers between 1 and 500 on the keyboard? Options: (a) 1156 (b) 1392 (c) 1480 (d) 1562 (Correct answer: 1-9 digits each 1 time, 9 times; 10-99, 90 two-digit numbers, 180 times; 100-500, 401 three-digit numbers, 1203 times, total 9 + 180 + 1203 = 1392, the answer is b). Common sense reasoning question (multiple choice): Xiao Wang wants to go to a crowded place. Where can he go? Options: (a) desert (b) residence (c) basement (d) concert (Correct answer: This place definitely needs to be crowded, so the answer is d). Common sense reasoning question (true / false): Will a pear sink in water? (Correct answer: The density of a pear is approximately 1 / 3, less than that of water, so the answer is no). Common sense reasoning question (date): A concert was originally scheduled for January 6, 2011, but was postponed by one day. What was the date 10 days before the concert? (Answer: The concert was originally scheduled for January 6, 2011, postponed by one day to January 7, 2011, and 10 days before was December 28, 2010). The correct answer describes the reasoning process, that is, the reasoning path. In actual operation, the system can send a labeling window to the target terminal, and relevant staff can label the target samples in the labeling window based on the target terminal. After the relevant staff completes the annotation, they can trigger a confirmation command. The system responds by detecting the confirmation command, receiving the inference path input by the relevant staff, and annotating the target sample using the inference path.
[0054] Finally, based on the prompt framework, target samples are labeled using the inference path. With the help of the "Prompt" framework, a fine-tuning stage is unnecessary, thus eliminating the need for a large labeled dataset and saving computational resources during the model fine-tuning phase.
[0055] The inference path prompt allows the model to decompose complex problems into many intermediate steps that can be solved individually, simulating the logical reasoning humans use in real-world problem-solving. This property makes it applicable to any task that humans can solve using language, giving it strong versatility. Furthermore, the inference path prompt guides the model to output the entire problem's reasoning logic during the inference phase, resulting in strong model interpretability and facilitating optimization in case of incorrect reasoning.
[0056] 204. Using the sample data in the model training set, train the first language model to obtain the second language model. The first language model is the basic language model.
[0057] In this embodiment, a training set containing high-quality samples is input into a first language model and an inverse model for training to obtain a second language model suitable for the target task. The first language model is a basic language model, such as LaMDA, GPT-3, and PaLM models.
[0058] Specifically, multiple test samples are extracted from the model test set corresponding to the target task, and these test samples are input into the second language model. Subsequently, multiple test results corresponding to the multiple test samples are received, and the test result corresponding to each test sample is compared with the standard result corresponding to the test sample to obtain multiple comparison results for the multiple test samples.
[0059] Furthermore, based on multiple comparison results, the prediction accuracy of the second language model is calculated. Specifically, multiple comparison results are identified, and a first value and a second value are statistically analyzed. The first value indicates the number of comparison results that match the standard result, and the second value represents the total number of comparison results. The ratio of the first value to the second value is calculated to obtain the prediction accuracy. The prediction accuracy is compared with a preset accuracy threshold. When the prediction accuracy is greater than or equal to the preset accuracy threshold, the target task data is acquired. When the prediction accuracy is less than or equal to the preset accuracy threshold, the second language model is retrained until the final test accuracy is greater than or equal to the preset accuracy threshold.
[0060] 205. Obtain the target task data, input the target task data into the second language model for language recognition, and obtain the inference results output by the second language model.
[0061] In this embodiment, after obtaining a second language model applicable to the target task, a specific reasoning task can be executed within the target task scenario. Specifically, target task data is acquired, input into the second language model, and the second language model outputs its reasoning result to obtain the answer corresponding to the target task data. It should be noted that the task scenario in which the target task data resides can be within an intelligent conversational assistant, such as a meeting booking scenario, which involves time information, such as "next Wednesday," "two days later," etc., requiring accurate reasoning to obtain the specific date. Furthermore, common sense questions or complex mathematical reasoning problems are also goals that intelligent machines are constantly pursuing, such as serving as intelligent chat partners for children or learning tutoring tools for children.
[0062] The method provided in this application first extracts a preset number of target samples from the model training set corresponding to the target task. Then, it annotates the target samples with inference paths and adds the annotated target samples to the model training set. Next, it uses the sample data from the model training set to train a first language model, obtaining a second language model, with the first language model serving as the base language model. Finally, it acquires the target task data, inputs it into the second language model for language recognition, and obtains the inference result output by the second language model. By adding inference path annotations to some target samples in the model training set to simulate the human thought process, the model can mimic the entire inference calculation process on new questions and obtain the correct answer, thereby improving the effectiveness and accuracy of the model's inference.
[0063] Furthermore, as Figure 1 To specifically implement the method, this application provides a natural language reasoning device based on reasoning paths, such as... Figure 3A As shown, the device includes: an extraction module 301, a transmission module 302, a training module 303, and an acquisition module 304.
[0064] The extraction module 301 is used to extract a preset number of target samples from the model training set corresponding to the target task;
[0065] The transfer module 302 is used to annotate the inference path of the target sample and add the annotated target sample to the model training set.
[0066] The training module 303 is used to train the first language model using sample data from the model training set to obtain the second language model, wherein the first language model is the base language model.
[0067] The acquisition module 304 is used to acquire target task data, input the target task data into the second language model for language recognition, and obtain the inference result output by the second language model.
[0068] In specific application scenarios, such as Figure 3B As shown, the device also includes a construction module 305.
[0069] The construction module 305 is used to collect text data from multiple data sources, construct the first language model based on the text data, and apply the first language model to the target task.
[0070] In a specific application scenario, the construction module 305 is used to number the text data, extract the text data with the target number as training data, and use the remaining text data after extraction as test data; define a basic model, train the basic model using the training data, and test the basic model using the test data; when the test results meet the preset conditions, the first language model is obtained.
[0071] In a specific application scenario, the transmission module 302 is used to extract sample data from different example sets in the model training set to obtain the preset number of target samples; for each target sample in the preset number of target samples, the target sample is identified and the inference path of the target sample is determined; and the target sample is labeled with the inference path according to the prompt framework.
[0072] In a specific application scenario, the transmission module 302 is used to determine the sample result corresponding to the target sample based on natural language processing technology; determine the reasoning process corresponding to the target sample based on the sample result, and take the multiple reasoning steps indicated by the reasoning process as the reasoning path. The reasoning process is used to describe the steps that the target sample goes through to obtain the sample result.
[0073] In specific application scenarios, such as Figure 3C As shown, the device further includes: an input module 306, a receiving module 307, a comparison module 308, and a calculation module 309.
[0074] The input module 306 is used to extract multiple test samples from the model test set corresponding to the target task and input the multiple test samples into the second language model.
[0075] The receiving module 307 is used to receive multiple test results corresponding to the multiple test samples;
[0076] The comparison module 308 is used to compare the test result corresponding to each test sample in the multiple test samples with the standard result corresponding to the test sample, so as to obtain multiple comparison results corresponding to the multiple test samples;
[0077] The calculation module 309 is used to calculate the prediction accuracy of the second language model based on the multiple comparison results;
[0078] The acquisition module 304 is used to acquire the target task data when the prediction accuracy is greater than or equal to a preset accuracy threshold.
[0079] In a specific application scenario, the calculation module 309 is used to identify the multiple comparison results, count a first value and a second value, wherein the first value is the number of comparison results that indicate that the test result is consistent with the standard result, and the second value is the number of all comparison results; calculate the ratio of the first value to the second value to obtain the prediction accuracy.
[0080] The apparatus provided in this application first extracts a preset number of target samples from the model training set corresponding to the target task. Then, it annotates the target samples with inference paths and adds the annotated target samples to the model training set. Next, it uses the sample data from the model training set to train a first language model, obtaining a second language model, where the first language model is the base language model. Finally, it acquires the target task data, inputs it into the second language model for language recognition, and obtains the inference result output by the second language model. By adding inference path annotations to some target samples in the model training set to simulate the human thought process, the model can mimic the entire inference calculation process on new problems and obtain the correct answer, thereby improving the effectiveness and accuracy of the model's inference.
[0081] It should be noted that other corresponding descriptions of the functional units involved in the natural language reasoning device based on reasoning paths provided in this application embodiment can be found in the following references. Figure 1 and Figures 2A to 2B The corresponding description in [the document] will not be repeated here.
[0082] In an exemplary embodiment, see Figure 4 The invention also provides a device comprising a communication bus, a processor, a memory, and a communication interface, and may further include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor executes the program stored in the memory to perform the natural language reasoning method based on reasoning paths described in the above embodiments.
[0083] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the natural language reasoning method based on reasoning paths.
[0084] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented in hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0085] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application.
[0086] Those skilled in the art will understand that the modules in the apparatus of the implementation scenario can be distributed within the apparatus of the implementation scenario as described, or they can be located in one or more apparatuses different from this implementation scenario, with corresponding changes. The modules of the above-described implementation scenario can be combined into one module, or they can be further divided into multiple sub-modules.
[0087] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of the implementation scenario.
[0088] The above disclosures are only a few specific implementation scenarios of this application. However, this application is not limited to these. Any variations that can be conceived by those skilled in the art should fall within the protection scope of this application.
Claims
1. A natural language reasoning method based on reasoning paths, characterized in that, include: In the model training set corresponding to the target task, sample data is extracted from different example sets in the model training set. A preset number of target samples are extracted according to different example set types, including mathematical calculation and common sense reasoning types. The extraction of the preset number of target samples includes: numbering the text data, randomly generating the target number value, and extracting the text data with the target number as the target sample. The preset number uses the system default value or is set by relevant personnel. The inference path annotation for the target samples includes: for each target sample, determining the corresponding sample result based on natural language processing technology, and determining an inference process simulating human thinking logic based on the sample result; using the inference process to describe the steps the target sample goes through to obtain the sample result; and using the multiple inference steps indicated by the inference process as an inference path; the system sends an annotation window to the target terminal, where relevant personnel annotate the target samples in the annotation window based on the target terminal; in response to a detected confirmation command, the system receives the inference path input by the relevant personnel and annotates the target samples using the inference path according to the prompt framework; and adding the annotated target samples to the model training set; wherein, some samples in the target samples are annotated with inference paths used to simulate human thinking logic. Using the sample data in the model training set, the first language model is trained to obtain the second language model, where the first language model is the basic language model. Acquire target task data, input the target task data into the second language model for language recognition, and obtain the inference result output by the second language model; The process of training the first language model to obtain the second language model further includes: comparing the test result corresponding to each test sample in the multiple test samples with the standard result corresponding to the test sample, and calculating the prediction accuracy; when the prediction accuracy is less than a preset accuracy threshold, re-acquiring text data to train the basic model until the final test accuracy is greater than or equal to the preset accuracy threshold.
2. The method according to claim 1, wherein before extracting a preset number of target samples from the model training set corresponding to the target task, the method further comprises: Text data is collected from multiple data sources, a first language model is constructed based on the text data, and the first language model is applied to the target task.
3. The method according to claim 2, characterized in that, The step of constructing the first language model based on the text data includes: The text data is numbered, and the text data with the target number is extracted as training data. The remaining text data after extraction is used as test data. Define a base model, train the base model using the training data, and test the base model using the test data; When the test results meet the preset conditions, the first language model is obtained.
4. The method according to claim 1, characterized in that, The step of labeling the inference path for the target sample includes: Sample data are extracted from different example sets in the model training set to obtain the preset number of target samples; For each target sample in the preset number of target samples, identify the target sample and determine the reasoning path of the target sample; Based on the prompt framework, the target sample is labeled using the inference path.
5. The method according to claim 1, characterized in that, The test results were determined based on the following method: In the model test set corresponding to the target task, multiple test samples are extracted and input into the second language model. Receive multiple test results corresponding to the multiple test samples.
6. The method according to claim 1, characterized in that, The calculation of prediction accuracy includes: Multiple comparison results are identified, and a first value and a second value are calculated. The first value is the number of comparison results that indicate that the test result is consistent with the standard result, and the second value is the total number of comparison results. The prediction accuracy is obtained by calculating the ratio of the first value to the second value.
7. A natural language reasoning device based on reasoning paths, characterized in that, include: The extraction module is used to extract sample data from different example sets in the model training set corresponding to the target task, and to extract a preset number of target samples according to different example set types, including mathematical calculation and common sense reasoning types; wherein, the extraction of the preset number of target samples includes: numbering the text data, randomly generating the target number value, and extracting the text data with the target number as the target sample from the text data; the preset number adopts the system default value or is set by relevant personnel; The delivery module is used to annotate the inference paths of the target samples, including: for each target sample, determining the sample result corresponding to the target sample based on natural language processing technology, and determining an inference process that simulates the human thinking logic process based on the sample result; using the inference process to describe the steps the target sample goes through to obtain the sample result; and using the multiple inference steps indicated by the inference process as an inference path; the system sends an annotation window to the target terminal, where relevant personnel annotate the target samples based on the target terminal in the annotation window; the system responds to the detection of a triggered confirmation command, receives the inference path input by the relevant personnel, and annotates the target samples using the inference path according to the prompt framework; and adds the annotated target samples to the model training set; wherein, some samples in the target samples are annotated with inference paths used to simulate the human thinking logic process. The training module is used to train the first language model using sample data from the model training set to obtain the second language model, wherein the first language model is the base language model. The acquisition module is used to acquire target task data, input the target task data into the second language model for language recognition, and obtain the inference result output by the second language model. The comparison module is used to compare the test result corresponding to each test sample in multiple test samples with the standard result corresponding to the test sample; The calculation module is used to calculate the prediction accuracy. The acquisition module is also used to reacquire text data to train the basic model when the prediction accuracy is less than a preset accuracy threshold, until the final test accuracy is greater than or equal to the preset accuracy threshold.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.