CN-119848448-B - Tool-enhanced-based large language model question-answering method and device
Abstract
The invention provides a tool-enhanced large language model question-answering method and device, wherein the method comprises the steps of carrying out intention recognition on an original question input by a user to obtain a data set corresponding to the original question, determining a tool set corresponding to the original question based on the data type of the data set, dividing the original question into a plurality of subtasks, determining an execution tool of each subtask in the plurality of subtasks, determining a parameter generation structure of the execution tool based on the tool type of the execution tool, determining calling parameters of the execution tool from the data set based on the subtask according to the parameter generation structure, calling the execution parameters of the execution tool to obtain a subtask execution result, and determining an output result of the original question based on the subtask execution result of each subtask in the plurality of subtasks.
Inventors
- XU BO
- He Aiyao
- CUI SIJIA
- WANG YANNA
- XU BO
Assignees
- 中国科学院自动化研究所
Dates
- Publication Date
- 20260505
- Application Date
- 20241118
Claims (8)
- 1. A tool-enhanced large language model question-answering method, applied to a large language model, comprising: Carrying out intention recognition on an original problem input by a user to obtain a data set corresponding to the original problem; determining a tool set corresponding to the original problem based on the data type of the data set; Dividing the original problem into a plurality of subtasks, and determining an execution tool of each subtask in the plurality of subtasks; determining a parameter generation structure of the execution tool based on the tool type of the execution tool; determining call parameters of the execution tool from the dataset according to the generation structure according to the parameters based on the subtasks; calling the execution tool to execute the calling parameters to obtain a subtask execution result; Determining an output result of the original problem based on a subtask execution result of each of the plurality of subtasks; Before determining the parameter generation structure of the execution tool based on the tool type of the execution tool, the method further comprises determining the tool type of the execution tool as a first type when the calling parameter required by the execution tool is smaller than a preset parameter threshold and the step to be executed of the execution tool is smaller than a preset step threshold, determining the tool type of the execution tool as a second type when the calling parameter required by the execution tool is smaller than the preset parameter threshold and the step to be executed of the execution tool is larger than the preset step threshold, and determining the tool type of the execution tool as a third type when the calling parameter required by the execution tool is larger than the preset parameter threshold and the step to be executed of the execution tool is smaller than the preset step threshold; The method comprises the steps of determining a parameter generation structure of an execution tool based on a tool type of the execution tool, wherein the parameter generation structure of the execution tool is determined to be a direct generation structure when the tool type of the execution tool is the first type, the parameter generation structure of the execution tool is determined to be a serial generation structure when the tool type of the execution tool is the second type, and the parameter generation structure of the execution tool is determined to be a parallel generation structure when the tool type of the execution tool is the third type.
- 2. The tool-enhanced large language model question-answering method according to claim 1, wherein the determining the output result of the original question based on the sub-task execution result of each of the plurality of sub-tasks comprises: The following processes are iteratively executed until a preset task decomposer determines the output result of the original problem: determining a next subtask to be executed based on a subtask execution result of the current subtask through the task decomposer; And executing the subtasks to be executed to obtain a subtask execution result of the subtasks to be executed.
- 3. The tool-based enhanced large language model question-answering method according to claim 2, further comprising: and returning a query failure result when the number of times of iterative execution is greater than a preset iterative threshold value.
- 4. The tool-enhanced large language model question-answering method according to claim 1, wherein the performing intention recognition on an original question inputted by a user to obtain a data set corresponding to the original question comprises: determining keywords of an original problem input by a user; and matching the data set corresponding to the original problem from a plurality of preset data sets based on the keywords.
- 5. A tool-enhanced large language model question-answering apparatus, comprising: The recognition module is used for carrying out intention recognition on the original problem input by the user to obtain a data set corresponding to the original problem; A screening module, configured to determine a tool set corresponding to the original problem based on a data type of the data set; the decomposition module is used for dividing the original problem into a plurality of subtasks and determining an execution tool of each subtask in the plurality of subtasks; A structure module for determining a parameter generation structure of the execution tool based on a tool type of the execution tool; A parameter module, configured to determine, based on the subtask, a call parameter of the execution tool from the dataset according to the generating structure according to the parameter; The execution module is used for calling the execution tool to execute the calling parameter to obtain a subtask execution result; The output module is used for determining an output result of the original problem based on a subtask execution result of each subtask in the plurality of subtasks; before determining the parameter generation structure of the execution tool based on the tool type of the execution tool, the device is further used for determining the tool type of the execution tool as a first type when the calling parameter required by the execution tool is smaller than a preset parameter threshold and the step to be executed of the execution tool is smaller than a preset step threshold, determining the tool type of the execution tool as a second type when the calling parameter required by the execution tool is smaller than the preset parameter threshold and the step to be executed of the execution tool is larger than the preset step threshold, and determining the tool type of the execution tool as a third type when the calling parameter required by the execution tool is larger than the preset parameter threshold and the step to be executed of the execution tool is smaller than the preset step threshold; The method comprises the steps of determining a parameter generation structure of an execution tool based on a tool type of the execution tool, wherein the parameter generation structure of the execution tool is determined to be a direct generation structure when the tool type of the execution tool is the first type, the parameter generation structure of the execution tool is determined to be a serial generation structure when the tool type of the execution tool is the second type, and the parameter generation structure of the execution tool is determined to be a parallel generation structure when the tool type of the execution tool is the third type.
- 6. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the tool-enhanced large language model question-answering method according to any one of claims 1 to 4 when the computer program is executed by the processor.
- 7. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the tool-enhanced large language model question-answering method according to any one of claims 1 to 4.
- 8. A computer program product comprising a computer program which when executed by a processor implements the tool-enhanced large language model question-answering method according to any one of claims 1 to 4.
Description
Tool-enhanced-based large language model question-answering method and device Technical Field The invention relates to the technical field of natural language processing, in particular to a tool-enhanced large language model question-answering method and device. Background Natural language processing (NLP, natural Language Processing) is directed to enabling computers to understand, interpret and generate human language, is an important way of man-machine interaction, and is an important part of the field of artificial intelligence research. In recent years, the advent and development of large language models (LLM, large Language Model) has provided an effective approach to solving NLP tasks and has shown excellent performance in innumerable NLP tasks. However, for multi-dataset question-answering tasks, existing solutions lack a process of identifying user intent, resulting in the large language model answering the question with the selected dataset not corresponding to the question, resulting in a wrong answer. Therefore, the large language model question answering method in the related technology has the technical problem of low question answering accuracy. Disclosure of Invention The invention provides a tool-enhanced large language model question-answering method and device, which are used for solving the defect of low question-answering accuracy of the large language model question-answering method in the prior art and improving the accuracy of the large language model in a multi-data set question-answering task. The invention provides a tool-enhanced large language model question-answering method, which comprises the following steps. Carrying out intention recognition on an original problem input by a user to obtain a data set corresponding to the original problem; Dividing the original problem into a plurality of subtasks, determining an execution tool of each subtask in the plurality of subtasks, determining a parameter generation structure of the execution tool based on a tool type of the execution tool, determining a calling parameter of the execution tool from the data set based on the subtask according to the parameter generation structure, calling the execution tool to execute the calling parameter to obtain a subtask execution result, and determining an output result of the original problem based on the subtask execution result of each subtask in the plurality of subtasks. The large language model question-answering method based on tool enhancement, before the tool type based on the execution tool determines the parameter generation structure of the execution tool, further comprises the steps of determining the tool type of the execution tool as a first type when the calling parameter required by the execution tool is smaller than a preset parameter threshold and the step to be executed of the execution tool is smaller than a preset step threshold, determining the tool type of the execution tool as a second type when the calling parameter required by the execution tool is smaller than the preset parameter threshold and the step to be executed of the execution tool is larger than the preset step threshold, and determining the tool type of the execution tool as a third type when the calling parameter required by the execution tool is larger than the preset parameter threshold and the step to be executed of the execution tool is smaller than the preset step threshold. The method for solving the problem of the large language model based on tool enhancement, which is provided by the invention, is characterized in that the parameter generation structure of the execution tool is determined based on the tool type of the execution tool, and comprises the steps of determining that the parameter generation structure of the execution tool is a direct generation structure when the tool type of the execution tool is the first type, determining that the parameter generation structure of the execution tool is a serial generation structure when the tool type of the execution tool is the second type, and determining that the parameter generation structure of the execution tool is a parallel generation structure when the tool type of the execution tool is the third type. The method for solving the problem of the large language model based on tool enhancement comprises the steps of iteratively executing the following processes until a preset task decomposer determines the output result of the original problem, determining the next sub-task to be executed based on the sub-task execution result of the current sub-task through the task decomposer, and executing the sub-task to be executed to obtain the sub-task execution result of the sub-task to be executed. The method for solving the question and answer of the large language model based on tool enhancement further comprises the step of returning a query failure result when the number of times of iterative execution is larger than a preset iteration threshold. Acc