Large language model long context tool invocation method and system based on divide-and-conquer strategy

By decomposing the tool invocation process of a large language model into parallel inference in multiple subspaces and introducing rigorous verification, the problems of tool selection and parameter filling in long contexts and high noise scenarios of large language models are solved, achieving higher accuracy and efficiency.

CN122132101APending Publication Date: 2026-06-02WUHAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN UNIV
Filing Date
2026-02-25
Publication Date
2026-06-02

Smart Images

  • Figure CN122132101A_ABST
    Figure CN122132101A_ABST
Patent Text Reader

Abstract

This invention provides a method and system for invoking long-context tools in a large language model based on a divide-and-conquer strategy, belonging to the field of natural language processing. This method innovatively proposes a "try-check-retry" divide-and-conquer reasoning paradigm. By decomposing a large candidate tool space into multiple subspaces for parallel reasoning, combined with strict pattern constraint verification, and finally aggregating valid results for global decision-making, it reduces the difficulty of reasoning and improves the accuracy of tool invocation. Furthermore, to further improve model reasoning efficiency, this invention also proposes a training-based optimization scheme. Utilizing the divide-and-conquer reasoning process, it automatically constructs thought chain data to fine-tune the large language model, internalizing the aforementioned divide-and-conquer reasoning capabilities into the model parameters, thus balancing the accuracy and efficiency of model reasoning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing, specifically relating to a method for calling tools in long contexts of large language models based on a divide-and-conquer strategy. It is suitable for solving the problems of tool selection and parameter filling in large language models under scenarios with a large number of tool contexts and a lot of noise. Background Technology

[0002] With the rapid development of artificial intelligence technology, large language models have achieved remarkable success in various tasks such as natural language understanding, generation, and reasoning. Modern large language models can follow various complex instructions from human users and generate fluent, high-quality text responses. However, large language models still face fundamental limitations: because their parameters are static and the knowledge boundaries of their training data are closed, they often struggle to acquire the latest real-time information and cannot directly interact with the physical world or external digital environments. To overcome this bottleneck, the "tool invocation" paradigm has emerged. This paradigm aims to integrate large language models with external tools and application programming interfaces (APIs), enabling them to solve complex real-world problems by giving them the ability to invoke external search engines, calculators, database queries, or specific business interfaces. In this process, the large language model acts as a "controller" or "brain," responsible for parsing user intent, selecting appropriate tools, generating accurate invocation parameters, and generating the final response based on the results returned by the tools.

[0003] While tool invocation techniques have significantly expanded the capabilities of models, existing methods still face considerable challenges in practical applications. First, the number of tools in the real world can be enormous. For example, a comprehensive intelligent agent system may connect to numerous application interfaces. When the number of candidate tools increases from dozens to hundreds, placing all tool descriptions (including function names, functional descriptions, parameter lists, etc.) into the model's context window leads to a dramatic increase in context length, making it difficult for the model to accurately locate key information. This directly results in a significant decrease in the accuracy of selecting the correct tool when faced with a massive number of candidate tools. Second, candidate tool sets are often filled with noise and interference. Many tools may be semantically very similar (e.g., "check the weather" and "check the temperature"), or have similar parameter structures but completely different functions. Such highly similar interference items can severely affect the model's judgment, causing the model to confuse tools or experience illusions when filling in parameters (e.g., using incorrect parameter names or data types). To address these issues, industry and academia have proposed various solutions. The mainstream approaches fall into two categories: one is retrieval-based augmentation. This method introduces an additional retrieval engine to filter a small number of relevant tools from a toolkit before inputting them into a large language model. While this effectively shortens the context length, it introduces a new bottleneck: the overall system performance is highly dependent on the retrieval engine's recall rate. If the retrieval engine fails to recall the truly needed tools, the subsequent large language model will be unable to complete the task. Moreover, simple retrieval cannot solve the problem of fine-grained semantic discrimination between similar tools. The other category is constraint-guided or fine-tuning-based methods. For example, using manually constructed error checklists to guide the model in self-correction, or guiding the model through step-by-step reasoning using specific formatted prompts. However, manually constructed checklists are often inflexible, unable to cover all potential error types, and difficult to transfer to new toolsets. While fine-tuning-based methods are effective, they often come with high data construction costs.

[0004] Existing large language models mostly employ direct prediction when performing tool invocation inference, i.e., outputting the tool invocation result all at once. When faced with long contexts and high noise interference, this direct inference approach lacks error correction mechanisms and deep reasoning processes. Therefore, designing a more efficient and robust framework to address the inference difficulties of large language models in scenarios with long contexts and multiple candidate tools without extensive manual intervention, fully leveraging the model's self-reflection capabilities to improve tool invocation accuracy while maintaining inference efficiency, is a crucial technical problem urgently needing to be solved in this field. Summary of the Invention

[0005] In view of this, the purpose of this invention is to provide a method for calling long-context tools in a large language model based on a divide-and-conquer strategy. This method innovatively proposes a "try-check-retry" divide-and-conquer reasoning paradigm. By decomposing the vast candidate tool space into multiple subspaces for parallel reasoning, combined with strict pattern constraint verification, and finally aggregating valid results for global decision-making, the reasoning difficulty is reduced and the accuracy of tool calling is improved. Furthermore, to further improve model reasoning efficiency, this invention also proposes a training-based optimization scheme. Utilizing the divide-and-conquer reasoning process, it automatically constructs thought chain data to fine-tune the large language model, internalizing the aforementioned divide-and-conquer reasoning capabilities into the model parameters, thus balancing the accuracy and efficiency of model reasoning.

[0006] To achieve the above-mentioned objectives, the technical solution adopted by this invention is: a method for invoking long-context tools in a large language model based on a divide-and-conquer strategy, comprising the following steps: (1) Design a strategic anchor grouping algorithm to mix and group the retrieved candidate tools with the tail tools, construct multiple parallel reasoning subspaces, and perform local reasoning in each subspace; (2) Construct a pattern consistency checker to strictly check the function name, parameter key name and data type of the tool call results generated by local inference, and filter out invalid illusions; (3) Aggregate valid candidate tools that have passed the validation and make a global final decision using the self-reflection capability of the large language model; (4) Based on the above training-free process, i.e. steps (1)-(3), construct the thinking chain data, fine-tune the large language model, internalize the divide-and-conquer reasoning ability, and realize efficient end-to-end tool calling.

[0007] Furthermore, the specific implementation of designing the strategic anchor grouping algorithm and performing local reasoning in each subspace in step (1) is as follows: 11) When faced with a massive number of candidate tools, directly including all tool descriptions in the prompts would result in excessively long context. Therefore, this invention first utilizes a lightweight retrieval tool (BM25 algorithm) based on the user's query. From the overall candidate tool library The most relevant results were retrieved from the search results. One tool, denoted as ;in This indicates the Nth tool.

[0008] 12) Considering that relying solely on the retrieval system may miss the correct tools, this invention employs a strategic anchor grouping strategy to construct... Parallel groups Specifically, retain the original. A set as an independent group (Benchmark group). For the rest Groups will The first in the tools The tool as the first The group's "anchor point," and from the remaining tail tool. Disjoint subsets are selected as distractors and added to the group. For example, if... The tail tools consist of 15 tools. We can evenly distribute these 15 tail tools into 5 anchor groups, with each group containing 1 anchor and 3 tail tools. The advantage of this grouping design is that each tail tool has the opportunity to enter a group and be "seen" by the model, thus compensating for the shortcomings of the retrieval system; each group contains only one high-confidence anchor tool and several low-confidence distractor tools, which physically decouples the tail tools. Tools that may be highly similar within a set (e.g., “check the weather” and “check the temperature”) force the model to independently evaluate the applicability of the anchor tool within the current group, rather than hesitating among multiple similar tools.

[0009] 13) For each subspace that has been constructed (in Large language model Local inference is performed independently and in parallel. The model analyzes the relevance of the user query to the tools within the current group in the subspace context, and outputs preliminary tool invocation results. Or an empty token representing "no tool call". This process is the "trial" phase, as shown in formula (1):

[0010] in, This indicates a user query. Indicates the first Each reasoning subspace (grouped) This represents a large language model. This step is parallel, so in a distributed system, inference for multiple groups can be performed simultaneously, and the total latency depends only on the inference time of the slowest group, resulting in high scalability.

[0011] Furthermore, the specific implementation method for constructing the schema consistency checker in step (2) is as follows: 21) Since the results of local inference may contain illusions (such as calling non-existent functions, fabricating parameter names, or incorrect parameter value types), this invention introduces a rule-based consistency checker. For the output of each local inference (in The function name. (as parameters), the verifier is based on the current subspace The tool definition performs the following three checks: Function name validity: It must be One of the tool names defined in the group. If the model calls a tool that does not belong to this group, or if it is misspelled, it is considered invalid.

[0012] Parameter key name validation: Generated parameters All keys must be in the tool The definition must contain the parameters. In particular, all parameters marked as "Required" in the tool definition must be present. Missing or extra parameters will result in validation failure.

[0013] Data type consistency: The value of a parameter must conform to the defined data type. For example, if a parameter is defined as Integer, generating the string "3" (convertible) will usually pass, but generating "three" (non-convertible) will fail; if defined as Boolean, generating a non-Boolean value will fail.

[0014] 22) Only if the tool's call result passes all three dimensions of validation simultaneously is it marked as a valid candidate; otherwise, it is discarded. This process is the "checking" phase, effectively filtering out low-level errors and format illusions in the model. Validation function Specifically, as shown in formula (2): Formula (2) in, The tool call results (including function names and parameters) output for local inference. Indicated for air conditioning. The tool definition pattern for the current subspace is indicated. To integrate the verification logic from the three dimensions mentioned above, we obtain a cleaned set of valid candidates. }

[0015] Furthermore, the specific implementation method for aggregating effective candidate tools for global final decision-making in step (3) is as follows: 31) Collect the tool definitions corresponding to all valid tool calls that passed the verification phase, and form a new, streamlined candidate tool set (retry set). This process aims to improve the signal-to-noise ratio of the candidate set and significantly eliminate interference terms, as shown in formula (3): Formula (3) in, For the retry set, For the original total candidate tool library, This is the set of valid candidates that have passed the verification. Indicates that the function name is included. and parameters The result of the call. Note that only the tool definition is extracted here, rather than directly using the parameters generated by the model during the local inference phase. This is because the context information is incomplete during local inference, and the generated parameters may be inaccurate. We need the model to regenerate the parameters from a global perspective.

[0016] 32) This streamlined set of retry attempts Provided as context to the large language model, the model is required to make a final self-reflection and decision based on the user query. Having undergone the preliminary steps (trial and error), the model is able to focus more on making an accurate selection from a small number of high-confidence candidates. This process is the "retry" phase, as shown in formula (4): Formula (4) in, For the final tool call result, For user queries, This is a streamlined set of tools. For large language models.

[0017] Furthermore, the specific implementation of the training-based optimization scheme in step (4) is as follows: 41) To address the time delay and computational cost issues caused by multiple inferences in the training-free process, this invention proposes internalizing the "try-check-retry" decision-making capability into the parameters of a large language model. Using existing tools to call datasets as raw corpora, the model generates thought chain data containing correct inference trajectories according to the aforementioned process (the entire try-check-retry process). Specifically, it records the candidate selection process in the "try" phase, the verification logic in the "check" phase, and the final review process in the "retry" phase, synthesizing data in the form of... <think>...the reasoning trajectory...< / think> <tool_call> ...finally called...< / tool_call> The training samples.

[0018] 42) Using the constructed Mind Chain dataset Supervised fine-tuning of the large language model is performed. The optimization objective is to minimize the negative log-likelihood loss of the inference trajectory and the final tool call, as shown in Equation (5): Formula (5) in, For loss function, For users to query and use the tool library, This involves a complete thought process chain encompassing "candidate selection - validation - final review" and the final result. The fine-tuned model can simulate the divide-and-conquer reasoning process in a single forward pass, achieving efficient end-to-end tool calls. In this way, the fine-tuned model learns to perform divide-and-conquer and self-reflection internally. During reasoning, only one forward pass is needed for the model to automatically output the result. <think> ...< / think> The analysis process is partially completed, followed by the output of high-quality tool call results. This method retains high performance while reducing inference complexity, resulting in extremely high efficiency.

[0019] The present invention also provides a long context tool invocation system for large language models based on a divide-and-conquer strategy, including a processor and a memory. The memory is used to store program instructions, and the processor is used to invoke the program instructions in the memory to execute the long context tool invocation method for large language models based on a divide-and-conquer strategy as described in the above technical solution.

[0020] The present invention also provides a computer-readable storage medium, including a readable storage medium on which a computer program is stored, wherein when the computer program is executed, it implements the long context tool invocation method for a large language model based on a divide-and-conquer strategy as described in the above technical solution.

[0021] In summary, the large language model tool invocation method proposed in this invention, based on a divide-and-conquer strategy, effectively solves the problems of noise interference and inference difficulties in long context tool invocation through a unique "try-verify-retry" mechanism, significantly improving the model's accuracy and robustness, and possessing extremely high application value and broad market prospects. Compared with existing technologies, the advantages and beneficial effects of this invention are as follows: 1) Compared with existing technologies for improving the tool invocation capabilities of large language models, this invention proposes a novel "try-check-retry" framework based on a divide-and-conquer strategy. This framework effectively solves the problem of attention diversion in long texts by decomposing complex long-context tasks into multiple simple local tasks, and significantly improves the accuracy of tool selection and parameter filling.

[0022] 2) Compared with methods that rely solely on the retrieval engine, the strategic anchor grouping mechanism proposed in this invention can effectively recall the correct "long-tail" tools missed by the retrieval engine, and enhances the model's ability to distinguish similar tools by introducing interference terms, thus having stronger robustness; at the same time, the introduced strict pattern consistency verification mechanism ensures the legality and executability of tool calls from the source.

[0023] 3) This invention provides two implementation variants: training-free and training-based. The training-free method is plug-and-play and suitable for scenarios where it is impossible to retrain the model; the training-based method, by internalizing the inference trajectory, significantly reduces inference latency while maintaining high performance, thus balancing flexibility and efficiency. Attached Figure Description

[0024] Figure 1 This is a flowchart of an embodiment of the present invention.

[0025] Figure 2 This is a flowchart of the trial phase of an embodiment of the present invention.

[0026] Figure 3 This is a flowchart of the training phase in an embodiment of the present invention. Detailed Implementation

[0027] To facilitate understanding and implementation of the present invention by those skilled in the art, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0028] like Figure 1 As shown, this invention provides a long-context tool invocation method for large language models based on a divide-and-conquer strategy, aiming to solve the performance degradation, attention loss, and illusion problems that occur when large language models face a massive number of candidate tools. This invention includes two specific implementation forms: a training-free tool divide-and-conquer invocation method and a training-based tool divide-and-conquer invocation method.

[0029] The tool divide-and-conquer method for training-free inference enhancement does not require parameter updates to large language models and is suitable for application development scenarios that directly call existing large model interfaces. This method mainly consists of three core phases: "try," "check," and "retry."

[0030] like Figure 2 As shown, this invention first designs a strategic anchor point grouping algorithm and performs local reasoning (trial phase) within each subspace, including the following steps: (1) Assume the user query is The total candidate tool library is ,in It could be very large. First, use a lightweight search engine based on the user's query. from The most relevant results were retrieved from the search results. One tool, denoted as In this embodiment, the retrieval algorithm chosen is the BM25 algorithm because it requires no training, is computationally efficient, and can quickly filter out potentially relevant tools based on keyword matching. Let... That is, select the 5 most relevant tools.

[0031] (2) Traditional The method directly discards the remaining tail tools. However, this would cause the correct tools missed by the retrieval system to completely lose the opportunity to be accessed by the model. To solve this problem, this invention constructs... There are parallel subspaces (groups), denoted as .

[0032] benchmark group ( ): Directly contains the original toolset This ensures that the model can see the entire set that the retrieval machine deems most relevant, preserving the advantages of baseline methods.

[0033] Anchor group ( to For the first Groups ( ), select The first in Each tool serves as an "anchor point" for the group. Meanwhile, tools from the tail end... A subset of disjoint elements is randomly or sequentially selected as "distractors" and added to the group.

[0034] (3) For each constructed subspace (in Large language model Perform reasoning independently. The input is the user query. and current subspace The tool description. The model output is a preliminary tool call result. Or an empty token representing "no tool call". This process is the "trial" phase, as shown in formula (1):

[0035] in, This indicates a user query. Indicates the first Each reasoning subspace (grouped) This represents a large language model. This step is parallel, so in a distributed system, inference for multiple groups can be performed simultaneously, and the total latency depends only on the inference time of the slowest group, resulting in high scalability.

[0036] Subsequently, this invention constructs a pattern consistency checker (checking phase) to filter local inference results: The model may produce illusions during the local inference phase, such as calling functions that do not exist in the group or fabricating parameters. To filter out these invalid results, this invention introduces a strict pattern consistency checker. .

[0037] For the output of each local inference (in The function name. (as parameters), the verifier is based on the current subspace The tool definition performs the following three checks: Function name validity: It must be One of the tool names defined in the group. If the model calls a tool that does not belong to this group, or if it is misspelled, it is considered invalid.

[0038] Parameter key name validation: Generated parameters All keys must be in the tool The definition must contain the parameters. In particular, all parameters marked as "Required" in the tool definition must be present. Missing or extra parameters will result in validation failure.

[0039] Data type consistency: The value of a parameter must conform to the defined data type. For example, if a parameter is defined as Integer, generating the string "123" (convertible) will usually pass, but generating "three" (non-convertible) will fail; if defined as Boolean, generating a non-Boolean value will fail.

[0040] Define the verification function The definition is as follows:

[0041] After this step, we obtain a cleaned and valid candidate set. This step significantly reduces the execution error rate caused by model illusion.

[0042] After the "trial" and "check" phases, we have narrowed down a set of highly probable candidate tools from a massive pool of options and eliminated incorrectly formatted calls. The current task is for the model to make a final decision among these high signal-to-noise ratio options. This invention then aggregates the effective candidate tools for a global final decision (retry phase): (1) This invention extracts the effective set The original definitions of all the tools involved form the retry toolset. .

[0043]

[0044] in, For the retry set, For the original total candidate tool library, This is the set of valid candidates that have passed the verification. Indicates that the function name is included. and parameters The result of the call. Note that only the tool definition is extracted here, rather than directly using the parameters generated by the model during the local inference phase. This is because the context information is incomplete during local inference, and the generated parameters may be inaccurate. We need the model to regenerate the parameters from a global perspective.

[0045] (2) Provided to the model as new context .because Its size is much smaller than the original tool library Furthermore, by eliminating a significant amount of irrelevant noise, the model can more accurately understand the semantics of the tool. The model is based on user queries. and Generate the final tool call result :

[0046] like Figure 1 As shown above, this process forms a closed-loop "try-check-retry" system. The divide-and-conquer search in the "try" phase expands the recall scope, the rule constraints in the "check" phase ensure accuracy, and the self-reflection in the "retry" phase achieves global optimality.

[0047] While the divide-and-conquer approach for training-free tools is highly effective, it requires multiple calls to the model. (Secondary reasoning), which may be limited in latency-sensitive scenarios. Therefore, this embodiment proposes a training-based method to distill the "thought process" of the above procedure into the model, enabling the model to internalize the divide-and-conquer strategy. Finally, as Figure 3 This invention constructs thought chain data based on the above-mentioned training-free process and performs fine-tuning training (training phase): (1) This invention utilizes existing tools to call datasets as raw corpora.

[0048] For each data entry (User question, candidate toolset, and real labels) We simulate the above "try-check-retry" process to construct the thought chain. The simulation of try-check involves iterating through all tools and recording the model's judgment process for each tool. To generate a high-quality thought chain, we designed a structured template that forces the model to output a thought process containing specific steps before generating the final tool call. The template is as follows: <think> Candidate options: Analyze user queries... (Tools for initial screening are listed here) Validation: Strictly validate the candidate list... (This simulates a check of parameters and types) Final Review: Eliminate distractions and focus on valid candidates... (Make the final decision here) < / think> <tool_call> ...Final tool call result...< / tool_call> in, <think>These are labels output by the large language model, representing the thought process.<tool_call> These are the labels output by the large language model, representing the results of tool calls; ultimately, successful samples are collected to form the Mind Chain training dataset. .

[0049] (2) Use the Mind Chain training dataset Supervised fine-tuning of large language models. Loss function. The design aims to minimize the negative log-likelihood of the thought chain text and the final tool call:

[0050] In this way, the fine-tuned model learns to perform divide-and-conquer and self-reflection internally. During inference, only one forward pass is needed for the model to automatically output the result. <think> ...< / think> The analysis process is partially completed, followed by the output of high-quality tool call results. This approach retains high performance while reducing inference complexity.

[0051] This invention demonstrates through extensive experiments that both training-free and training-based divide-and-conquer methods exhibit significant performance advantages. The training-free method achieves an average gain of up to +25.10% compared to the baseline in BFCL and ACEBench benchmark tests; while the training-based method enables Qwen2.5-7B to achieve performance comparable to or even better than proprietary large-scale language models such as OpenAI o3 and Claude-Haiku-4.5.

[0052] Secondly, embodiments of the present invention also provide a large language model long context tool invocation system based on a divide-and-conquer strategy, including a processor and a memory. The memory is used to store program instructions, and the processor is used to invoke the program instructions in the memory to execute the large language model long context tool invocation method based on the divide-and-conquer strategy as described in the above technical solution.

[0053] Thirdly, embodiments of the present invention also provide a computer-readable storage medium, including a readable storage medium on which a computer program is stored, wherein when the computer program is executed, it implements the long context tool invocation method for a large language model based on a divide-and-conquer strategy as described in the above technical solution.

[0054] It should be understood that the above description of the preferred embodiments is quite detailed, but it should not be considered as a limitation on the scope of protection of this invention. Those skilled in the art, under the guidance of this invention, can make substitutions or modifications without departing from the scope of protection of the claims of this invention, and all such substitutions or modifications fall within the scope of protection of this invention. The scope of protection of this invention should be determined by the appended claims.< / think>

Claims

1. A method for invoking long-context tools in a large language model based on a divide-and-conquer strategy, characterized in that: Includes the following steps: Step 1, Trial Phase: Design a strategic anchor grouping algorithm to mix and group the retrieved candidate tools with tail tools, construct multiple parallel inference subspaces, and perform local inference within each subspace; Step 2, Inspection Phase: Construct a schema consistency checker to strictly verify the function names, parameter key names, and data types of the tool call results generated by local inference, filtering out invalid illusions; Step 3, Retry Phase: Aggregate valid candidate tools that have passed the validation and make a global final decision using the self-reflective capability of the large language model; Step 4: Based on the thought chain data constructed in Steps 1-3, fine-tune and train the large language model to achieve end-to-end tool calls.

2. The method for invoking long context tools for large language models based on a divide-and-conquer strategy as described in claim 1, characterized in that: The specific implementation method of step 1 is as follows: Step 11: Use a lightweight search engine to search based on the user query. From the overall candidate tool library The most relevant results were retrieved from the search results. One tool, denoted as ,in This represents the Nth tool; Step 12, construct using a strategic anchor grouping algorithm. Parallel groups Specifically, retain the original A set as an independent group That is, the baseline group, for the rest Groups will The first in the tools The tool as the first The group's anchor point, and from the remaining tail tool Disjoint subsets are selected as interference items and added to the group; Step 13, for each subspace that has been constructed ,in Large language model Local inference is performed independently and in parallel. The large language model analyzes the relevance of the user query to the tools within the current group in the subspace context and outputs preliminary tool invocation results. Alternatively, an empty token representing no tool call is used; this process is the trial phase.

3. The method for invoking long context tools in a large language model based on a divide-and-conquer strategy as described in claim 2, characterized in that: The trial phase is specifically shown in formula (1): in, This indicates a user query. Indicates the first A reasoning subspace, Represents a large language model.

4. The method for invoking long context tools in a large language model based on a divide-and-conquer strategy as described in claim 2, characterized in that: The lightweight retrieval tool uses the BM25 algorithm.

5. The method for invoking long context tools in a large language model based on a divide-and-conquer strategy as described in claim 1, characterized in that: The specific implementation method for step 2 is as follows: Step 21: Introduce a rule-based consistency checker. For the output of each local inference ,in The function name. The parameter is used by the validator based on the current subspace. The tool definition performs the following three checks: Function name validity: It must be One of the tool names defined in the language model; if the large language model calls a tool that does not belong to the corresponding subspace, or if it is misspelled, it is considered invalid; Parameter key name validation: Generated parameters All keys must be in the tool The definition states that all parameters marked as required in the tool definition must be present; missing or extra parameters will be considered as validation failure. Data type consistency: The value of a parameter must conform to the defined data type; Step 22: Only if the verification function composed of the above three dimensions is passed simultaneously will the tool call result be marked as a valid candidate; otherwise, it will be discarded. This process is called the checking phase.

6. The method for invoking long context tools for large language models based on a divide-and-conquer strategy as described in claim 5, characterized in that: Validation function Specifically, as shown in formula (2): Official (2) in, The tool call results output for local inference include the function name and parameters. Indicated for air conditioning. The tool definition pattern for the current subspace is indicated. By integrating the verification logic across three dimensions, a cleaned and valid candidate set is ultimately obtained. } 7. The method for invoking long context tools for large language models based on a divide-and-conquer strategy as described in claim 1, characterized in that: The specific implementation method of step 3 is as follows: Step 31: Collect the tool definitions corresponding to all valid tool calls that passed the verification phase, and form a new, concise set of candidate tools, i.e., the retry set, as shown in formula (3): Official (3) in, For the retry set, For the original total candidate tool library, This is the set of valid candidates that have passed the verification. Indicates that the function name is included. and parameters The result of the call; Step 32, refine this set of retries Provided as context to the large language model, the large language model is required to perform final self-reflection and decision-making based on user queries. This process is the retry phase, as shown in formula (4): Official (4) in, For the final tool call result, For user queries, This is a streamlined set of tools. For large language models.

8. The method for invoking long context tools for large language models based on a divide-and-conquer strategy as described in claim 1, characterized in that: The specific implementation method of step 4 is as follows: Step 41: Using existing tools, call the dataset as the raw corpus and generate thought chain data containing the correct reasoning trajectory according to steps 1-3; Step 42, use the constructed thought chain dataset as denoted as Supervised fine-tuning of the large language model aims to minimize the negative log-likelihood loss of the inference trajectory and the final tool call, as shown in Equation (5): Official (5) in, For loss function, For users to query and use the tool library, This includes the complete thought process and final result, encompassing candidate selection, verification, and final review.

9. A long-context tool invocation system for large language models based on a divide-and-conquer strategy, characterized by: It includes a processor and a memory, the memory being used to store program instructions, and the processor being used to invoke the program instructions in the memory to execute the long context tool invocation method for large language models based on the divide-and-conquer strategy as described in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, It includes a readable storage medium on which a computer program is stored, and when the computer program is executed, it implements the long context tool invocation method for large language models based on a divide-and-conquer strategy as described in any one of claims 1-8.