A tool chain scheduling method and system based on tool set optimization

By combining a sequence recommendation model based on a self-attention mechanism with a pre-trained language model, a large set of model tools is dynamically selected, which solves the problems of insufficient accuracy and redundancy in tool selection, and improves the system's operating efficiency and personalized adaptation capabilities.

CN123159342APending Publication Date: 2026-11-24BEIHANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611087181.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-21
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In existing technologies, when large models perform complex tasks, the accuracy of tool selection is insufficient, and the toolset selection is redundant, which increases the computational burden on the system. Furthermore, the system cannot adapt to users' personalized preferences, and historical interaction data is not integrated, affecting the system's scalability and operating efficiency.

Method used

A sequence recommendation model based on self-attention mechanism (such as SASRec) is used to extract the temporal dependency features of the tool call sequence. Semantic similarity is calculated by combining a pre-trained language model (such as BERT). The candidate tool set is dynamically screened by weighted fusion of habit score and semantic similarity score.

Benefits of technology

It improved the accuracy of tool selection, reduced redundant tools, enhanced system operating efficiency and response speed, and enabled dynamic capture of user personalized preferences and optimization of the toolset.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123159342A_ABST
    Figure CN123159342A_ABST
Patent Text Reader

Abstract

This invention relates to the field of artificial intelligence technology, and more particularly to a method and system for scheduling a large model toolchain based on toolset optimization. The method includes: acquiring the historical tool call sequence of a target object; inputting the historical tool call sequence into a sequence recommendation model based on a self-attention mechanism to obtain a tool usage habit score; determining a semantic similarity score based on the semantic similarity between the current task instruction and the tool function description information; and weightedly fusing the tool usage habit score and the semantic similarity score, and selecting candidate toolsets from the toolset based on the comprehensive score for execution by a large language model. This invention can dynamically capture the time dependence and personalized preferences of users' tool usage habits, effectively eliminate redundant and low-relevance tools, and improve the accuracy of tool selection and system operating efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method and system for scheduling large model toolchains based on toolset optimization. Background Technology

[0002] With the rapid development of large language model technology, large models often rely on multiple external tools to work together when performing complex tasks such as information retrieval, data processing, and task planning. Existing toolchain scheduling schemes typically manage tool calls using static rules or simple priority ranking mechanisms. For example, a fixed tool call order is preset, or tools suitable for the current task are selected based on a single-dimensional semantic matching method. Although some schemes introduce tool call frequency statistics to prioritize tools with higher call frequencies, they still lack a systematic integration of historical interaction data and the semantic information of the tools themselves. This approach, relying on static rules or simple statistical features, lacks in-depth mining and integration of tool usage scenarios, historical interaction data, and contextual semantics, resulting in insufficient accuracy in tool selection, inability to capture the time-series dependencies in the tool call process, and difficulty in adapting to users' personalized preferences. Furthermore, the lack of dynamic optimization strategies that combine tool description semantic similarity with user habits during the toolset selection process leads to redundancy and low relevance in the selected toolsets, increasing the system's computational burden and limiting its scalability and overall operating efficiency.

[0003] Therefore, there is an urgent need to provide a technical solution to address the above problems. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention provides a large model toolchain scheduling method and system based on toolset optimization.

[0005] Firstly, this invention provides a large model toolchain scheduling method based on toolset optimization, used to select candidate tools adapted to the current task from the available toolset for large language models to call and execute. The technical solution of this method is as follows: S100. Obtain the historical tool call sequence of the target object; the historical tool call sequence consists of the unique identifiers of each tool that has been called, arranged in chronological order of call time, reflecting the historical call behavior pattern of the target object; S200. Input the historical tool call sequence into a sequence recommendation model based on a self-attention mechanism for predicting tool call tendency. Extract time-dependent features from the historical tool call sequence through the sequence recommendation model to obtain tool usage habit scores that characterize tool call preference for each candidate tool in the tool set. S300. Based on the semantic similarity between the received current task instruction and the functional description information of each tool in the tool set, determine the semantic similarity score that reflects the task relevance. S400. The tool usage habit score and the semantic similarity score are weighted and fused to obtain a comprehensive score. Based on the comprehensive score, a candidate tool set is selected from the tool set for the large language model to call and execute.

[0006] The beneficial effects of the large model toolchain scheduling method based on toolset optimization of the present invention are as follows: The method of this invention extracts temporal dependency features from historical tool call sequences by introducing a sequence recommendation model. This dynamically captures the temporal dependency and personalized preferences of users' tool usage habits. It also combines the semantic similarity of the current task instructions for two-dimensional weighted fusion, effectively eliminating redundant and low-relevance tools. This solves the problems of insufficient tool selection accuracy and redundant toolset screening in the prior art, and significantly improves the accuracy of tool selection and system operating efficiency.

[0007] Based on the above scheme, the large model toolchain scheduling method based on toolset optimization of the present invention can be further improved as follows.

[0008] In an alternative embodiment, S200 includes: The historical tool call sequence is embedded and encoded to obtain a sequence embedding vector. Based on the sequence embedding vector, the unique identifier of each tool in the historical tool call sequence is mapped to a feature representation in a continuous vector space to preserve the temporal position information of the tool call. The sequence embedding vector is input into the self-attention layer of the sequence recommendation model. The self-attention layer captures the temporal dependency of the tool call order in the historical tool call sequence and outputs the tool usage habit score. The temporal dependency represents the influence of the order of tools in the historical call sequence on the subsequent tool selection tendency.

[0009] Among the above-mentioned alternative approaches, by using embedding encoding and self-attention mechanisms, the temporal position information and dependencies in the tool call sequence can be accurately captured, thereby more accurately predicting the user's tool usage tendency.

[0010] In one alternative embodiment, S300 includes: The current task instruction is semantically encoded using a pre-trained language model to obtain an instruction semantic vector, which is used to characterize the semantic features of the current task intent. The pre-trained language model is used to semantically encode the functional description information of each tool in the tool set to obtain a tool semantic vector; the tool semantic vector is used to characterize the functional semantic features of each tool in the tool set. The similarity between the instruction semantic vector and the tool semantic vectors of each tool in the tool set is calculated and used as the semantic similarity score. The semantic similarity score is used to characterize the instant matching relationship between the current task intent and the functional description information of each tool in the tool set.

[0011] Among the above-mentioned alternative methods, deep semantic features are extracted using pre-trained language models, and the degree of real-time matching between the current task intent and the tool function is accurately measured by calculating semantic similarity, thus making up for the possible biases that may be caused by relying solely on historical data.

[0012] In one alternative embodiment, S400 includes: The tool usage habit score and the semantic similarity score are weighted and fused to obtain the comprehensive score of each candidate tool in the tool set; wherein, the comprehensive score is used to jointly evaluate the adaptability of each candidate tool in the tool set from two complementary dimensions: historical calling behavior and current task intent. The weight of the tool usage habit score reflects the degree of influence of historical calling behavior on tool selection, and the weight of the semantic similarity score reflects the degree of influence of current task intent on tool selection. Candidate tools whose comprehensive scores meet the screening threshold conditions are identified as tools in the candidate tool set for the large language model to call and execute; the screening threshold conditions are used to eliminate candidate tools that are not relevant in either the historical call behavior dimension or the current task intent dimension.

[0013] Among the above-mentioned optional methods, by weighted fusion of two-dimensional scores and setting a screening threshold, a comprehensive evaluation and dynamic simplification of candidate tools is achieved, effectively eliminating redundant tools and reducing the computational burden on the system.

[0014] In one optional approach, the weighted fusion of the tool usage habit score and the semantic similarity score to obtain the comprehensive score of each candidate tool in the tool set includes: The overall score for each candidate tool in the toolset is calculated according to the following formula: ; in, Let be the overall score of the i-th candidate tool. The tool usage habit score for the i-th candidate tool. Let be the semantic similarity score of the i-th candidate tool. The preference weight coefficient has a value range of [0,1] and is used to adjust the relative importance of the historical call behavior dimension and the current task intent dimension in the comprehensive evaluation. The screening threshold condition is: the comprehensive score of each candidate tool in the tool set is not lower than the preset screening threshold; the preset screening threshold is used to define the minimum adaptation standard of the candidate tool in the dimensions of historical call behavior and current task intent, so as to eliminate candidate tools whose comprehensive scores in both dimensions do not meet the standard.

[0015] Among the above optional methods, specific weighted fusion formulas and screening threshold conditions are provided. By adjusting the weight coefficients to balance historical preferences and immediate intentions, the controllability and accuracy of the screening process are ensured.

[0016] In one optional approach, the sequence recommendation model based on the self-attention mechanism is the SASRec model; the embedding encoding of the historical tool call sequence to obtain a sequence embedding vector includes: The unique identifiers of each tool in the historical tool call sequence are embedded and encoded through the embedding layer of the SASRec model to obtain the embedding vectors corresponding to the unique identifiers of each tool, and the embedding vectors corresponding to the unique identifiers of each tool are combined into the sequence embedding vector.

[0017] Among the above-mentioned optional methods, the SASRec model is selected for sequence modeling. Its powerful self-attention mechanism is used to process variable-length sequences, which further improves the efficiency and accuracy of temporal-dependent feature extraction.

[0018] In one alternative approach, the step of inputting the sequence embedding vector into a self-attention layer in the sequence recommendation model, capturing the temporal dependencies of tool call order in the historical tool call sequence through the self-attention layer, and outputting the tool usage habit score includes: The sequence embedding vector is self-attentionally calculated by the self-attention layer of the SASRec model to capture the temporal dependency of the tool call order in the historical tool call sequence, and a sequence representation vector is obtained. The sequence representation vector is used to aggregate the temporal context information of each tool call in the historical call sequence to form an overall representation of the tool usage habits of the target object. Based on the similarity between the sequence representation vector and the tool embedding representation of each candidate tool in the tool set, the tool usage habit score is obtained; the tool embedding representation is the vector representation of each candidate tool in the tool set in the SASRec model for preference matching calculation with the sequence representation vector.

[0019] Among the above optional methods, the self-attention calculation process inside the SASRec model is described in detail. By matching the sequence representation vector with the tool embedding representation, a quantitative score of the user's tool usage habits is achieved.

[0020] In one alternative approach, the pre-trained language model is a BERT model; The calculation of the similarity between the instruction semantic vector and the tool semantic vectors of each tool in the tool set, as the semantic similarity score, includes: Calculate the cosine similarity between the instruction semantic vector and the tool semantic vectors of each tool in the tool set; the cosine similarity is used to measure the directional proximity of the task intent and the tool function in the semantic feature space to reflect their semantic correlation. The cosine similarity is normalized to obtain the semantic similarity score; the normalization process is used to map the similarity value to a preset numerical range to unify the comparison benchmark of the semantic similarity scores of each tool in the tool set.

[0021] Among the above-mentioned optional methods, the BERT model is used to extract semantic features and cosine similarity is used for calculation. At the same time, the scoring criteria are unified through normalization, which ensures the accuracy and comparability of semantic similarity scores.

[0022] In one alternative approach, after selecting the candidate toolset, the method further includes: The context information of the current task is obtained through the large language model, and the target tool required for the current step is determined from the candidate tool set and executed based on the context information; wherein, the context information includes the current task instruction and the results of previous tool calls obtained during the sequential execution of the current task; After obtaining the execution result of the target tool, the context information is updated based on the execution result, and the target tool required for the next step is determined from the candidate tool set and executed according to the updated context information; Repeat the steps of determining the target tool required for the current step from the candidate toolset and invoking its execution until the current task is completed.

[0023] Among the above-mentioned optional approaches, a unified scheduling framework with multiple iterations was constructed. Through dynamic updates of context information and cyclic execution, efficient collaboration of multiple tools under complex tasks was achieved, improving the inference ability and response quality of large models.

[0024] Secondly, the present invention provides a large model toolchain scheduling system based on toolset optimization, the system being configured to execute a large model toolchain scheduling method based on toolset optimization as described in any of the above schemes.

[0025] The above solution achieves dynamic modeling and precise filtering of tool calls by executing the above method through the system, thereby improving the system's intelligence level and response efficiency.

[0026] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0027] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 This is a flowchart illustrating an embodiment of a large model toolchain scheduling method based on toolset optimization according to the present invention. Figure 2 This is a schematic diagram of the complete processing flow of the habit score extraction tool in the SASRec model of this invention; Figure 3 This is a schematic diagram of the core process for generating a tool usage habit score in this invention; Figure 4 This is a schematic diagram of the core process of the dynamic candidate selection toolset of this invention; Figure 5 This is a schematic diagram of an embodiment of a large model toolchain scheduling system based on toolset optimization according to the present invention. Detailed Implementation

[0028] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0029] Example 1: like Figure 1 As shown, this embodiment provides a large model toolchain scheduling method based on toolset optimization, used to filter candidate tools adapted to the current task from the available toolset for execution by the large language model. This method is executed by a large model toolchain scheduling system based on toolset optimization, such as... Figure 1 As shown, it includes the following steps: S100. Obtain the historical tool call sequence of the target object; the historical tool call sequence consists of the unique identifiers of each tool that has been called, arranged in chronological order of call time, reflecting the historical call behavior pattern of the target object.

[0030] Specifically, the target object can be a user or intelligent agent interacting with a large language model. The historical tool call sequence is a record of tool usage over a past period. For example, if a user previously used a "weather query tool," a "map navigation tool," and a "restaurant reservation tool," the generated historical tool call sequence could be represented as: {ID Weather ID Map ID Restaurant}; The unique identifier can be a numerical number, string code, or other unique identification information assigned to the tool during system registration. This embodiment emphasizes the "temporal sequence," meaning that the order in which tools are invoked implies the user's behavioral logic and task flow habits. For example, checking the weather is often followed immediately by arranging travel navigation. This sequential information forms the basis for subsequent preference prediction.

[0031] S200. Input the historical tool call sequence into a sequence recommendation model based on a self-attention mechanism for predicting tool call tendency. Extract temporal dependency features from the historical tool call sequence through the sequence recommendation model to obtain tool usage habit scores that characterize tool call preference for each candidate tool in the tool set.

[0032] Specifically, this step aims to mine users' personalized preferences from historical behavior. Unlike the simple statistical frequency analysis in existing technologies, this embodiment employs a sequence recommendation model based on a self-attention mechanism, which can capture the temporal dependencies between tool calls. For example, although both "payment tools" and "shopping tools" are called frequently, the sequence recommendation model can identify a strong dependency of "browsing products first, then adding them to the cart, and finally paying," while the probability of "payment tools" appearing after "weather query" is lower. Through temporal dependency feature extraction, the tool usage habit score output by the model not only reflects the popularity of the tool but also the tendency for a particular tool to be called under specific contexts or user habits. This tendency score is a probability value or a normalized score; the higher the score, the more the tool matches the user's historical operating habits.

[0033] S300. Based on the semantic similarity between the received current task instruction and the functional description information of each tool in the tool set, determine a semantic similarity score that reflects the task relevance.

[0034] Specifically, the current task instruction is the natural language text entered by the user, such as "Book me a flight to Beijing." The functional descriptions of each tool in the toolkit are predefined text, such as "Flight booking tool: Provides domestic and international flight search and booking services." This step utilizes semantic matching technology to calculate the similarity between the instruction text and the tool description text. This process reflects an "instant matching" relationship, that is, finding the tool with the most matching function for the current specific task intent. For example, when a user enters "I want to listen to music," even if "video playback tool" is frequently used in the history, the semantic similarity score of "music playback tool" will be higher, thus adapting to temporary changes in user intent and compensating for potential biases caused by relying solely on historical habits.

[0035] S400. The tool usage habit score and the semantic similarity score are weighted and fused to obtain a comprehensive score. Based on the comprehensive score, a candidate tool set is selected from the tool set for the large language model to call and execute.

[0036] Specifically, weighted fusion is a key means of balancing "historical habits" and "current intentions." In practical applications, relying solely on historical habits may lead to rigid recommendation results that fail to respond to new user needs; while relying solely on semantic matching may ignore users' personalized operational preferences, resulting in recommendation results that do not conform to user habits.

[0037] This embodiment combines the scores from two dimensions using a weighted fusion formula to calculate a comprehensive score. For example, for a given tool, its comprehensive score can be a weighted sum of its habit score and semantic score. Subsequently, a selection process is performed based on the comprehensive score, for example, by setting a selection threshold and retaining only tools with comprehensive scores higher than the threshold as candidate tools. This selection process serves to "reduce noise" and "reduce workload," eliminating redundant tools that are neither in line with user habits nor relevant to the current task. This reduces the search space of the large language model, lowers the computational burden, and improves the accuracy and response speed of tool invocation.

[0038] Example 2: This embodiment, based on Embodiment 1, provides a detailed explanation of the sequence recommendation model and its processing procedure involved in step S200. Specifically, this embodiment selects the SASRec model as the sequence recommendation model based on the self-attention mechanism.

[0039] In step S200, the historical tool call sequence is input into a sequence recommendation model based on a self-attention mechanism to predict tool call tendency. The sequence recommendation model extracts temporal dependency features from the historical tool call sequence to obtain tool usage habit scores representing tool call preference for each candidate tool in the tool set. The specific processing includes the following steps: First, the historical tool call sequence is embedded and encoded to obtain a sequence embedding vector. Based on the sequence embedding vector, the unique identifier of each tool in the historical tool call sequence is mapped to a feature representation in a continuous vector space to preserve the temporal position information of the tool call.

[0040] Specifically, since the historical tool call sequence is an ordered list composed of discrete tool unique identifiers, computers cannot directly understand the underlying semantic relationships and temporal logic. Therefore, it needs to be processed through the embedding layer of the SASRec model, i.e.: The unique identifiers of each tool in the historical tool call sequence are embedded and encoded through the embedding layer of the SASRec model to obtain the embedding vectors corresponding to the unique identifiers of each tool, and the embedding vectors corresponding to the unique identifiers of each tool are combined into the sequence embedding vector.

[0041] In this process, embedding encoding not only maps discrete tool IDs to continuous vectors with fixed dimensions, but more importantly, it introduces a positional encoding mechanism. Positional encoding can assign a positional feature representing the order in which each tool vector in the sequence is invoked. For example, for the sequence {weather query, map navigation, restaurant reservation}, positional encoding allows the model to distinguish whether "weather query" is invoked before or after "map navigation".

[0042] Preserving this temporal location information is fundamental to accurately capturing user behavior habits. Without preserving this information, the model will be unable to distinguish the order of calls, leading to misjudgments of user habits. In this embodiment, the dimension of the embedding vector can be set according to the training data and the number of tools, for example, set to 50 dimensions or higher, to ensure that the vector space has sufficient expressive power to represent the complex relationships between tools.

[0043] Secondly, the sequence embedding vector is input into the self-attention layer in the sequence recommendation model. The self-attention layer captures the temporal dependency of the tool call order in the historical tool call sequence and outputs the tool usage habit score.

[0044] The temporal dependency relationship represents the influence of the order of tools in the historical call sequence on the tendency to select subsequent tools.

[0045] Specifically, the core advantage of the SASRec model lies in its self-attention mechanism, which is well-suited for handling variable-length sequences and effectively captures long-short-term dependencies. Compared to traditional recurrent neural networks (RNNs) or long short-term memory networks (LSTMs), the SASRec model can directly calculate the association weights between any two positions in the sequence through its self-attention mechanism, thereby capturing the temporal dependency features within the sequence in parallel.

[0046] For example, the model might discover that after a user calls a "ticket booking tool," they often call a "payment tool" within a short period of time; this strong correlation is a type of temporal dependency. Through the encoding process, the model outputs an encoded sequence representation vector, which aggregates the contextual information of the entire historical sequence. Subsequently, the model calculates the similarity between this sequence representation vector and the embedding representations of each candidate tool in the tool set, ultimately outputting a tool usage habit score. This score reflects the probability or tendency of a user to call a particular tool next, given their current historical behavior pattern.

[0047] By introducing the SASRec model for time-dependent feature extraction, this embodiment can accurately extract implicit personalized preferences from complex user historical behavior, avoiding the shortcomings of traditional statistical methods that only focus on frequency and ignore order, thereby significantly improving the relevance and accuracy of tool recommendations.

[0048] To facilitate understanding of the complete processing flow of the SASRec model extraction tool for user habit scores, such as Figure 2 As shown, the process clearly presents the key steps from inputting historical tool call sequences to the final output of tool usage habit scores for each candidate tool. The process first embeds and encodes the input historical tool call sequences, mapping discrete tool unique identifiers to sequence embedding vectors that retain temporal positional information. Then, the sequence embedding vectors are input into a self-attention layer, which uses self-attention calculation to capture the temporal dependencies of tool call order, generating sequence representation vectors that aggregate historical context information. Finally, the similarity between the sequence representation vectors and the embedding representations of each candidate tool is calculated, outputting tool usage habit scores that represent tool call preference.

[0049] Example 3: This embodiment, based on Embodiment 2, provides a detailed explanation of the self-attention layer computation logic within the SASRec model. Specifically, the step of inputting the sequence embedding vector into the self-attention layer of the sequence recommendation model, capturing the temporal dependencies of tool call order in the historical tool call sequence through the self-attention layer, and outputting the tool usage habit score includes: First, the sequence embedding vector is self-attentionally calculated through the self-attention layer of the SASRec model to capture the temporal dependency of the tool call order in the historical tool call sequence, thus obtaining the sequence representation vector.

[0050] The sequence representation vector is used to aggregate the temporal context information of each tool call in the historical call sequence to form an overall representation of the tool usage habits of the target object.

[0051] Specifically, the core of the self-attention mechanism lies in dynamically adjusting the contribution of features by calculating the correlation weights between elements in the sequence. In the SASRec model, the self-attention layer receives the sequence embedding vector E obtained in the aforementioned embodiment and maps it to three matrices: a query matrix Q, a key matrix K, and a value matrix V. These three matrices are obtained by linearly transforming the sequence embedding vector with a trainable weight matrix. Subsequently, the self-attention layer calculates the dot product of the query matrix Q and the key matrix K, and performs scaling and Softmax normalization to obtain the attention weight matrix. This attention weight matrix reflects the correlation strength between tools at different positions in the sequence. For example, in the historical sequence "map query - weather query - temperature conversion", the model may learn that there is a high attention weight between "weather query" and "temperature conversion", indicating a strong temporal dependency between the two. Finally, the attention weight matrix is ​​multiplied by the value matrix V to obtain a weighted output vector. This output vector, after subsequent processing such as a feedforward neural network, generates the sequence representation vector.

[0052] It should be understood that, compared to traditional recurrent neural networks (RNNs) or long short-term memory networks (LSTMs) that process sequences sequentially, the self-attention mechanism can compute the dependencies between any two positions in a sequence in parallel, thus capturing long-distance temporal dependencies more efficiently. This means that even if a user's historical call sequence is very long, or related tool calls are spaced far apart in time, the SASRec model described in this embodiment can still accurately capture the correlation between them, avoiding the gradient vanishing or information forgetting problems that traditional models are prone to in long sequence modeling.

[0053] Secondly, based on the similarity between the sequence representation vector and the tool embedding representation of each candidate tool in the tool set, the tool usage habit score is obtained.

[0054] The tool embedding is represented as the vector representation of each candidate tool in the tool set in the SASRec model for preference matching calculation with the sequence representation vector.

[0055] Specifically, the sequence representation vector can be viewed as a "portrait" of a user's historical behavioral habits, while the tool embedding representation is the "identity feature" of each tool in the tool set. In order to predict the tool that a user may call next, the model needs to calculate the degree of matching between the sequence representation vector and the tool embedding representation of each candidate tool.

[0056] In this embodiment, the degree of matching can be measured by calculating the dot product or cosine similarity between vectors. The calculated similarity score is the tool usage habit score. The physical meaning of this score is that it represents the probability or tendency to call the tool next based on the user's existing historical behavior patterns. The higher the score, the more the tool matches the user's historical operating habits, and the greater the likelihood that the user will choose the tool. For example, if the sequence representation vector contains strong "travel planning" features, then the habit score calculated for the tool embedding representation of "map navigation tool" or "flight booking tool" will be higher, while the score for "file compression tool" will be lower.

[0057] In this way, this embodiment realizes the transformation from abstract historical sequences to specific preference scores, providing a quantitative basis for subsequent screening.

[0058] To facilitate understanding of the core process of generating usage habit scores for the tool in this invention, such as Figure 3 As shown, the process first obtains the historical tool call sequence of the target object. This sequence consists of unique identifiers of each tool arranged in chronological order of call time, reflecting the user's historical call behavior patterns. Then, the sequence is embedded and encoded using the embedding layer of a sequence recommendation model (preferably the SASRec model in this invention). This maps the discrete tool identifiers into feature representations in a continuous vector space, and introduces positional encoding to preserve the temporal positional information of tool calls. Next, the obtained sequence embedding vector is input into a self-attention layer. The self-attention mechanism captures the temporal dependencies of tool call order by calculating the association weights between tools in the sequence, for example, identifying the behavior pattern of users often calling weather query tools after using map queries. After self-attention calculation, a sequence representation vector is generated. This vector aggregates the contextual information of the entire historical sequence, forming a holistic representation of the user's tool usage habits. Finally, the similarity between the sequence representation vector and the embedding representations of each candidate tool in the tool set is calculated, outputting a tool usage habit score. This score not only reflects the historical call frequency of the tool but also the tendency to call the tool next under specific user habits, thus achieving precise quantification of user personalized preferences.

[0059] Example 4: This embodiment, based on Embodiment 1, provides a detailed explanation of the specific process for determining the semantic similarity score in step S300. Specifically, this embodiment uses a pre-trained language model to extract and match semantic features.

[0060] In step S300, based on the semantic similarity between the received current task instruction and the functional description information of each tool in the tool set, a semantic similarity score reflecting task relevance is determined, specifically including the following processing steps: First, the current task instruction is semantically encoded using a pre-trained language model to obtain an instruction semantic vector, which is used to represent the semantic features of the current task intent.

[0061] Simultaneously, the pre-trained language model is used to semantically encode the functional description information of each tool in the tool set to obtain a tool semantic vector; the tool semantic vector is used to characterize the functional semantic features of each tool in the tool set.

[0062] Specifically, this embodiment preferably uses the BERT (Bidirectional Encoder Representations from Transformers) model as the pre-trained language model.

[0063] The BERT model, through its bidirectional Transformer structure, is able to deeply understand the contextual relationships within natural language text, thereby generating high-quality semantic vector representations. For the current task instruction, such as "Book me a flight to Beijing," the BERT model transforms it into a fixed-dimensional instruction semantic vector. Similarly, for each tool in the toolkit, such as "Flight booking tool: Provides domestic and international flight search and booking services," the BERT model transforms its functional description text into a corresponding tool semantic vector.

[0064] It should be understood that, in addition to the BERT model, other pre-trained models that can extract deep semantic features of text, such as RoBERTa and ALBERT, are also applicable to this embodiment. Those skilled in the art can choose according to actual computing resources and accuracy requirements.

[0065] Next, the similarity between the instruction semantic vector and the tool semantic vectors of each tool in the tool set is calculated as the semantic similarity score; the semantic similarity score is used to characterize the instant matching relationship between the current task intent and the functional description information of each tool in the tool set.

[0066] Specifically, this embodiment uses the cosine similarity between the instruction semantic vector and the tool semantic vectors of each tool in the tool set to measure similarity; The cosine similarity is used to measure the directional proximity of task intent and tool function in the semantic feature space to reflect their semantic relevance. The closer the cosine value is to 1, the more consistent the directions of the two vectors are, that is, the higher the matching degree between task intent and tool function; conversely, the closer the cosine value is to 0, the lower the relevance between the two.

[0067] After calculating the cosine similarity, this embodiment further normalizes the cosine similarity to obtain the semantic similarity score.

[0068] The normalization process is used to map similarity values ​​to a preset numerical range to unify the comparison benchmark for semantic similarity scores of tools in the toolset.

[0069] Specifically, normalization maps similarity values ​​to a preset numerical range, such as [0,1], to unify the comparison benchmark for semantic similarity scores among tools in the toolset. This step is crucial because in the subsequent step S400, the semantic similarity score and the tool usage habit score need to be weighted and fused. The tool usage habit score is usually output by the SASRec model and normalized, and its value range is usually also between [0,1]. Without normalization, the scores of different dimensions may have different units, causing the fusion result to be biased towards the dimension with the larger value, thus affecting the accuracy of the screening.

[0070] By normalizing the data, we ensured that the semantic similarity score and the tool usage habit score were on the same scale, so that the weighted fusion could truly reflect the combined contribution of historical preferences and current intentions.

[0071] For example, suppose the instruction semantic vector is v ctx The tool semantic vector of a certain tool is v desc (t i If the cosine similarity is such that the cosine similarity is calculated, then the formula for calculating the cosine similarity can be expressed as: ; Among them, s' s (t i The cosine similarity is calculated. Then, s' is normalized using a normalization function (such as Min-Max normalization or a simple linear mapping). s (t i The mapping is used to obtain the final semantic similarity score s. s (t i If the cosine similarity range is [-1, 1], it can be linearly mapped to the interval [0, 1], i.e., s s (t i )=(s' s (t i ()+1) / 2. Thus, when the task instructions and tool descriptions are highly consistent, the score approaches 1; when the semantics are opposite or irrelevant, the score approaches 0.

[0072] Through the above process, this embodiment achieves accurate matching of task intent and tool function at the semantic level, providing reliable real-time matching data support for subsequent two-dimensional fusion screening.

[0073] Example 5: This embodiment, based on Embodiment 1, provides a detailed explanation of the weighted fusion and filtering process in step S400. Specifically, the tool usage habit score and the semantic similarity score are weighted and fused to obtain the comprehensive score of each candidate tool in the tool set.

[0074] The comprehensive score is used to jointly evaluate the suitability of each candidate tool in the tool set from two complementary dimensions: historical call behavior and current task intent. The weight of the tool usage habit score reflects the degree of influence of historical call behavior on tool selection, and the weight of the semantic similarity score reflects the degree of influence of current task intent on tool selection.

[0075] Specifically, this embodiment uses a preset weighted fusion algorithm to numerically synthesize the habit score and semantic score obtained in the aforementioned steps. The comprehensive score is then calculated for each candidate tool in the toolset according to the following comprehensive score calculation formula: ; Wherein s(t) i Let s be the overall score of the i-th candidate tool. u (t i ) represents the tool usage habit score for the i-th candidate tool, s s (t i ) represents the semantic similarity score of the i-th candidate tool, and α is the preference weight coefficient with a value range of [0,1]. The preference weight coefficient is used to adjust the relative importance of the historical call behavior dimension and the current task intent dimension in the comprehensive evaluation.

[0076] It should be understood that setting the weighting coefficient α is key to achieving a balance between "personalization" and "immediacy." If a user's historical behavior patterns are relatively stable, such as if the user frequently uses a specific combination of tools in a fixed office setting, then the value of α can be appropriately increased, such as setting it to 0.7 or 0.8, allowing historical habits to dominate decision-making, thereby improving response speed and prediction accuracy. Conversely, if the current task instruction is more complex or significantly deviates from the user's usual operating habits, such as if the user suddenly raises a new query request, then the value of α can be appropriately decreased, such as setting it to 0.3 or 0.4, assigning higher weight to semantic similarity, to ensure that the system can flexibly respond to the user's immediate intent and avoid being misled by fixed historical habits.

[0077] In a preferred embodiment, α is set to 0.6, which means that the system slightly favors the user's historical usage habits when making decisions, while also reserving 40% weight for the current task intent, so as to balance the accuracy of personalized recommendations and intent matching.

[0078] After calculating the comprehensive score, the candidate tools whose comprehensive scores meet the screening threshold conditions are identified as tools in the candidate tool set for the large language model to call and execute.

[0079] The filtering threshold is used to eliminate candidate tools that are not relevant in either the historical call behavior dimension or the current task intent dimension.

[0080] Specifically, the screening threshold condition is: the comprehensive score of each candidate tool in the tool set is not lower than the preset screening threshold; the preset screening threshold is used to define the minimum adaptation standard of the candidate tool in the dimensions of historical call behavior and current task intent in order to eliminate candidate tools whose comprehensive scores in both dimensions do not meet the standard.

[0081] For example, the preset filtering threshold can be set to 0.5. If a tool has a low tool usage habit score (e.g., users rarely use the tool) and a low semantic similarity score (e.g., the tool's function is irrelevant to the current command), its overall score will inevitably be below 0.5, and the tool will be removed from the candidate tool set. This filtering mechanism serves to "reduce noise" and "lighten the load." On the one hand, it filters out a large number of low-relevance interfering tools, avoiding large language models from wasting inference resources on irrelevant tools; On the other hand, it narrows the tool search space, allowing large language models to focus more on tools with high probability of relevance, thereby improving the accuracy of tool invocation and the overall operating efficiency of the system.

[0082] By employing this dual-dimensional weighted fusion and threshold filtering strategy, this embodiment effectively solves the problems of insufficient tool selection accuracy and redundant toolset filtering in the prior art, and achieves dynamic optimization of the toolset.

[0083] It should be understood that the dual-dimensional weighted fusion and threshold filtering strategy adopted in this embodiment has significant advantages in terms of system scalability. Some existing tool scheduling schemes, in pursuit of higher matching accuracy, tend to extract multi-dimensional information for each tool, such as the tool's inherent functional attributes, historical running statistics, and inter-tool dependencies, and then construct a unified feature representation space based on this for matching and combination optimization.

[0084] While such solutions offer rich information dimensions, their computational overhead increases dramatically with the size of the toolkit: the computational cost of the inherent attributes and historical statistical data of the tools grows roughly linearly with the number of tools, while modeling the inter-tool dependencies (such as dependency analysis and compatibility assessment) often leads to superlinear or even exponential growth in computational complexity. When the toolkit contains hundreds or even thousands of tools, the construction and maintenance of this complex feature space becomes a performance bottleneck for the system, making it difficult to meet the response requirements of real-time scheduling.

[0085] In contrast, this embodiment uses only two lightweight dimensions: tool usage habit score and semantic similarity score. The habit score is output once by the sequence recommendation model, and the semantic similarity score can be obtained by vector encoding and cosine similarity calculation of the pre-trained language model. The computational complexity of both is linearly related to the number of tools, and there is no need to explicitly model and store the interdependencies between tools.

[0086] Therefore, the two-dimensional approach in this embodiment achieves dynamic optimization of the toolset with extremely low computational overhead while ensuring the accuracy of the screening. This enables the system to maintain efficient real-time response capabilities when facing a large-scale toolset and has good scalability.

[0087] To facilitate understanding of the core process of the dynamic candidate selection toolset of this invention, such as Figure 4 As shown, this process obtains evaluation scores in parallel across two dimensions: one is from... Figure 3 The system generates two sets of scores: a tool usage habit score, which characterizes the user's historical usage preferences; and a semantic similarity score, calculated based on the current task instruction and the description information of each tool's function. This invention preferably uses a BERT pre-trained model to semantically encode the instruction text and tool description text, and obtains this score through cosine similarity calculation and normalization, reflecting the immediate matching degree between the current task intent and the tool's function. Subsequently, the two scores are weighted and fused using a preset preference weight coefficient α (value range [0,1], preferably α=0.6). The calculation formula is: comprehensive score = α × habit score + (1-α) × semantic score, thereby jointly evaluating the adaptability of each tool from two complementary dimensions: historical usage behavior and current task intent. Finally, the system judges based on a preset screening threshold (preferably 0.5): tools with a comprehensive score below the threshold are deemed to lack relevance in both dimensions and are eliminated; tools with a comprehensive score not lower than the threshold are retained, forming a concise and relevant candidate tool set. This screening process effectively eliminated redundant and low-relevance tools, narrowed the tool search space for large language models, reduced the system's computational burden, and significantly improved the accuracy of tool selection and overall operational efficiency.

[0088] Example 6: This embodiment, based on any one of embodiments 1 to 5, provides a detailed description of the subsequent processing steps after selecting the candidate toolset. Specifically, after selecting the candidate toolset, the method further includes the following iterative invocation and closed-loop execution steps: First, the context information of the current task is obtained through the large language model, and based on the context information, the target tool required for the current step is determined from the candidate toolset and invoked for execution.

[0089] The context information includes the current task instruction and the results of previous tool calls obtained during the sequential execution of the current task.

[0090] Specifically, the large language model, as the core engine of scheduling decisions, undertakes the decision-making function of "understanding-matching-selection" in each iteration. First, it performs semantic parsing on the accumulated contextual information to extract the task intent features of the current step; then, it matches and compares these intent features with the functional descriptions of each tool in the candidate toolkit to evaluate the adaptability of each tool to the requirements of the current step; finally, based on the matching evaluation results, it determines the tool with the highest adaptability as the target tool for the current step and initiates the call.

[0091] It should be understood that the composition of context information is dynamically evolving: at the beginning of task execution, the context information only contains the current task instructions input by the user, and the large language model understands the overall goal of the task and selects the first execution tool based on this; in subsequent iterations, the results of the preceding tool calls are appended to the context information, enabling the large language model to infer the next operation requirements based on the intermediate execution results obtained, thereby ensuring the logical coherence between the various stages in a multi-step task.

[0092] Secondly, after obtaining the execution result of the target tool, the context information is updated based on the execution result, and the target tool required for the next step is determined from the candidate tool set and executed according to the updated context information.

[0093] Specifically, this is a closed-loop process of "execution-update-re-decision". The result of each tool call is fed back to the system, updating the context information. The updated context information contains the latest task status, providing a basis for the next decision.

[0094] This mechanism ensures logical connections between steps in complex tasks. For example, after the "temperature conversion" tool completes its execution, its output Fahrenheit value is updated in the context. Based on this, the large language model can determine that the conversion task is complete and the next step should be the "send email" step. It should be understood that this iterative mechanism based on context updates enables the present invention to handle multi-step tasks with complex dependencies, rather than just single-round question-and-answer or instruction execution.

[0095] Finally, the steps of determining the target tool required for the current step from the candidate toolset and invoking its execution are repeated until the current task is completed.

[0096] Specifically, the system continuously monitors the task's completion status. In each iteration, the large language model determines whether the task has been completed based on the current context information. If not, it continues to select a tool from the candidate toolkit for execution; if completed, the scheduling process ends.

[0097] This cyclical execution process demonstrates the coherence advantage of this solution in multi-step tasks. For example, when a user inputs the command "Check today's weather in Shanghai, convert Celsius to Fahrenheit, and then email it to Li Si," the system first filters out a candidate toolset that includes tools such as "weather query," "temperature conversion," and "email sending."

[0098] Subsequently, in the first iteration, the large language model selected and executed the "weather query tool" according to the instruction to obtain Shanghai weather data. In the second iteration, the "temperature conversion tool" is selected for calculation based on the weather data in the context and the "Celsius to Fahrenheit" command; In the third iteration, based on the results of the first two steps and the "send email" instruction, the "email sending tool" was selected to send the organized information to Li Si.

[0099] Once the task is completed, the loop ends. Through this iterative call and closed-loop execution mechanism, this invention achieves automated decomposition and coherent processing of complex tasks, significantly improving the intelligence level of large model toolchain scheduling.

[0100] Example 7: like Figure 5 As shown, this embodiment provides a large model toolchain scheduling system 500 based on toolset optimization, which is configured to execute the large model toolchain scheduling method based on toolset optimization as described in any of the foregoing embodiments of the present invention.

[0101] Specifically, the system achieves efficient scheduling and optimization of the toolchain through a modular architecture design. The system mainly includes a sequence acquisition module 510, a habit prediction module 520, a semantic matching module 530, a fusion filtering module 540, and a scheduling and execution module 550.

[0102] The sequence acquisition module 510 is used to execute step S100, that is, to acquire the historical tool call sequence of the target object.

[0103] This module, acting as the system's data input, is responsible for extracting user tool call records over a past period from system logs or the database. Specifically, the sequence acquisition module cleans and sorts the raw call records, transforming them into a sequence composed of unique identifiers for each called tool, arranged chronologically. For example, this module can interface with the interaction log interface of a large language model to capture user action data in real time and generate sequences such as {ID}. ToolA ID ToolB ID ToolC The sequence data is provided for subsequent modules to process.

[0104] The habit prediction module 520 is used to perform step S200, which is to input the historical tool call sequence into a sequence recommendation model based on a self-attention mechanism for predicting tool call tendency, and extract time-dependent features from the historical tool call sequence through the sequence recommendation model to obtain a tool usage habit score representing the tool call preference for each candidate tool in the tool set.

[0105] This module incorporates a pre-trained SASRec model or other sequence recommendation model units. Specifically, the habit prediction module receives the historical tool call sequences output by the sequence acquisition module. First, it transforms the discrete tool IDs into continuous vector representations through an embedding layer. Then, it uses a self-attention mechanism to capture the temporal dependencies within the sequence, ultimately outputting the habit score for each candidate tool. This module is the core of the system's personalized recommendation mechanism, capable of mining users' latent preferences from historical behavioral data.

[0106] The semantic matching module 530 is used to perform step S300, that is, to determine a semantic similarity score reflecting the relevance of the task based on the semantic similarity between the received current task instruction and the functional description information of each tool in the tool set.

[0107] This module incorporates pre-trained language model units, such as the BERT model. Specifically, the semantic matching module receives the current task instruction text input by the user and reads the functional description text of each tool in the toolkit. It uses the BERT model to semantically encode both types of text, obtaining instruction semantic vectors and tool semantic vectors, and then calculates and normalizes the cosine similarity between them. This module ensures that the system can accurately understand the user's immediate intent and find the functionally matching tool, compensating for potential biases caused by relying solely on historical habits.

[0108] The fusion filtering module 540 is used to perform step S400, which is to weight and fuse the tool usage habit score and the semantic similarity score to obtain a comprehensive score, and to filter out a candidate tool set from the tool set based on the comprehensive score for the large language model to call and execute.

[0109] This module serves as the system's decision-making hub. Specifically, the fusion filtering module receives the habit score output by the habit prediction module and the semantic score output by the semantic matching module, and performs a weighted calculation based on a preset weighting coefficient α to obtain a comprehensive score. Subsequently, the module filters the toolset according to a preset filtering threshold (e.g., 0.5), eliminating tools that do not meet the comprehensive score, and generating the final candidate toolset. This module effectively balances users' historical habits and current intentions through a two-dimensional fusion strategy, achieving dynamic optimization and simplification of the toolset.

[0110] The scheduling and execution module 550 is used to execute the iterative invocation steps following step S400. Specifically, the scheduling and execution module provides the candidate toolset generated by the fusion and filtering module to the large language model. Based on the context information of the current task, the large language model determines the target tool required for the current step from the candidate toolset and invokes it for execution. After obtaining the execution result, the scheduling and execution module updates the context information and triggers the next round of tool selection and invocation until the task is completed. This module demonstrates the system's closed-loop execution capability in multi-step task processing.

[0111] It should be understood that the data flow between the above modules is closely related: the sequence acquisition module provides input data to the habit prediction module; the habit prediction module and the semantic matching module process in parallel, extracting features from both historical and real-time dimensions respectively; the fusion and filtering module combines the outputs of the two modules to make a decision; and the scheduling and execution module completes the final task execution based on the decision results. This modular architecture design not only makes the system's logic clear, easy to maintain and expand, but also ensures the professionalism and processing efficiency of each functional module, thereby improving the overall accuracy and response speed of the large model toolchain scheduling.

[0112] The parameters and steps for implementing the corresponding functions of each module in the large model toolchain scheduling system based on toolset optimization described above can be referred to the parameters and steps in the embodiments of the large model toolchain scheduling method based on toolset optimization mentioned above, and will not be repeated here.

[0113] Example 8: To more intuitively demonstrate the practical application effect of the technical solution of the present invention, this embodiment takes a specific intelligent office assistant scenario as an example to describe in detail the methods described in the above embodiments. It should be understood that this embodiment is only used to explain the present invention and does not constitute a limitation on the scope of protection of the present invention.

[0114] In this application scenario, the user inputs a complex task command into the intelligent office assistant: "Check today's weather in Shanghai, convert Celsius to Fahrenheit, and then email it to Li Si." The system's preset toolset contains multiple registered tools, each with a unique identifier (ID) and a functional description. For example, the toolset includes: The "Meteorological Environment Query Tool" with ID 001 is described as "used to query environmental meteorological data such as weather, temperature, air quality, PM2.5, and precipitation forecasts for cities across the country". The "Temperature Calculation Tool" with ID 002 is described as "providing temperature and numerical formula conversion and accurate calculation, and automatically completing standardized conversion"; The "Enterprise Email Sending Tool" with ID 003 is described as having the function of "entering the recipient, body, and attachments, connecting to the enterprise email interface, and sending customized emails with one click"; The "map query tool" with ID 004 is described as "providing services for users who need to query their location for travel, navigation and other purposes".

[0115] First, the system executes step S100 to obtain the historical tool call sequence of the target object (i.e., the current user). Assume that the user has sequentially called the "Map Query Tool," "Weather Query Tool," and "Temperature Converter Tool" in their historical interactions. The system extracts these historical call records and generates the historical tool call sequence S={ID}. 004 ID 001 ID 002 The sequence, arranged chronologically by call time, reflects typical user behavior patterns when handling travel or environment-related tasks.

[0116] Next, the system executes step S200, inputting the historical tool call sequence into a sequence recommendation model based on a self-attention mechanism (preferably using the SASRec model in this embodiment). The model maps the tool IDs in the sequence to vectors through an embedding layer and uses a self-attention mechanism to capture the temporal dependency features within the sequence.

[0117] For example, the model identifies that users often check the weather after querying a map, and then may perform temperature calculations after checking the weather. Based on this temporal dependency, the model outputs a tool usage habit score for each candidate tool in the tool set. Assume the model output scores are as follows: For "temperature calculation tool" (ID) 002 Because it is more likely to be at the end of the historical sequence, it has a higher habit score of 0.58. For "Enterprise Email Sending Tools" (ID) 003Although it did not appear directly in the historical sequence, the model predicted that it might be invoked based on contextual association, and the habit score was 0.75. For the "Meteorological Environment Inquiry Tool" (ID) 001 The habit score was 0.05. For "map query tool" (ID) 004 The habit score was 0.40.

[0118] These scores quantify users' tendency to use various tools based on their historical habits.

[0119] Meanwhile, the system executes step S300, determining a semantic similarity score based on the semantic similarity between the received current task instruction and the functional description information of each tool in the tool set. The system uses a pre-trained language model (preferably the BERT model in this embodiment) to semantically encode the user instruction "Help me check today's Shanghai weather, convert Celsius to Fahrenheit, and send the information to Li Si via email" to obtain an instruction semantic vector.

[0120] Simultaneously, the functional description text of each tool is semantically encoded to obtain tool semantic vectors. By calculating the cosine similarity between the instruction semantic vector and the semantic vectors of each tool, and then normalizing the result, a semantic similarity score is obtained. Assume the calculation results are as follows: The semantic score of the "Weather and Environment Query Tool" is 0.85 (the instruction contains "check the weather"). The semantic score for the "Temperature Calculation Tool" is 0.90 (the instruction contains "Celsius to Fahrenheit"). The semantic score for “Enterprise Email Sending Tool” is 0.95 (the instruction contains “send email”). The semantic score for “Map Query Tool” is 0.10 (the instruction does not involve map navigation).

[0121] These scores reflect the immediate match between the functionality of each tool and the intent of the current task.

[0122] Subsequently, the system executes step S400, which weights and fuses the tool usage habit score and semantic similarity score to obtain a comprehensive score. In this embodiment, the preference weight coefficient α is set to 0.6, which means that the system slightly favors the user's historical usage habits when making decisions, while also reserving 40% weight for the current task intent.

[0123] According to the formula The system calculates a comprehensive score for each tool. For example: For the "Meteorological Environment Inquiry Tool", the overall score is 0.6 × 0.05 + 0.4 × 0.85 = 0.37; For the "temperature calculation tool", the overall score is 0.6 × 0.58 + 0.4 × 0.90 = 0.71; For "Enterprise Email Sending Tools", the overall score is 0.6 × 0.75 + 0.4 × 0.95 = 0.83; For the "map query tool", the overall score is 0.6 × 0.40 + 0.4 × 0.10 = 0.28.

[0124] After calculating the overall score, the system filters candidate tools from the toolset based on the overall score. In this embodiment, a preset filtering threshold of 0.5 is set, meaning only tools with an overall score of not less than 0.5 are retained. After filtering, "Weather Environment Query Tool" (0.37) and "Map Query Tool" (0.28) are removed because their scores are below the threshold, while "Temperature Calculation Tool" (0.71) and "Enterprise Email Sending Tool" (0.83) are retained in the candidate toolset.

[0125] This filtering process effectively eliminates redundant tools that are inconsistent with the current task intent and do not conform to the user's historical habits, thus optimizing the toolset.

[0126] Compared to existing technologies, if only semantic similarity scores are used for filtering, although the semantic score of "weather environment query tool" is relatively high (0.85), its overall score is dragged down due to its extremely low historical habit score, and it is ultimately eliminated. This demonstrates the advantage of introducing the historical habit dimension in this invention, namely, it can avoid recommending intermediate step tools (such as repeatedly querying the weather) that users may no longer need when they already have a clear intention to perform subsequent operations (such as sending emails), thereby more accurately predicting the user's actual needs. At the same time, if only historical habits are relied upon, the new intention of "sending emails" suddenly raised by the user may be overlooked, while this invention, by supplementing the semantic similarity dimension, successfully includes "enterprise email sending tool" in the candidate set.

[0127] Finally, based on the selected candidate toolset, the system executes an iterative call and closed-loop execution process. The large language model obtains the context information of the current task. First, based on the instruction "check today's Shanghai weather", it finds that the candidate toolset does not directly contain weather query tools (they have been removed), but the large model can determine from the context that weather data needs to be obtained first.

[0128] At this point, the system can be dynamically adjusted or confirmed through multiple rounds of dialogue. Alternatively, in a preferred embodiment of the invention, the screening threshold can be dynamically adjusted or some high semantic score tools can be retained as alternatives.

[0129] Suppose that in the first iteration, the system, through contextual reasoning, invoked the "meteorological environment query tool" (if the threshold is adjusted) or obtained weather data through other means, which was not completely excluded.

[0130] Subsequently, the system updates the context information, adding the acquired Shanghai weather data (such as Celsius values) to the context. In the second iteration, the large language model, based on the updated context and the instruction "convert Celsius to Fahrenheit," selects the "temperature calculation tool" from the candidate toolset and executes it to obtain the Fahrenheit value. In the third iteration, based on the results of the first two steps and the instruction "organize and send an email to Li Si," the system selects the "enterprise email sending tool" as the target tool and executes it to send the organized weather information to Li Si. The loop ends upon completion of the task.

[0131] Through this unified scheduling framework, this embodiment achieves automated and coherent processing of complex, multi-step tasks, significantly improving user experience and system operating efficiency.

[0132] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention, such as adjusting the network structure of the sequence recommendation model, replacing the semantic matching algorithm, or changing the specific calculation method of weighted fusion, should be covered within the scope of protection of the present invention.

[0133] Those skilled in the art will recognize that this invention can be implemented as a system, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: it can be entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, the invention can also be implemented as a computer program product contained in one or more computer-readable media, which includes computer-readable program code.

[0134] Any combination of one or more computer-readable media can be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0135] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A tool chain scheduling method based on tool set optimization for large language model, for screening candidate tools from available tool sets to adapt to current tasks for large language model calling execution, characterized in that, include: S100. Obtain the historical tool call sequence of the target object; the historical tool call sequence consists of the unique identifiers of each tool that has been called, arranged in chronological order of call time, reflecting the historical call behavior pattern of the target object; S200. Input the historical tool call sequence into a sequence recommendation model based on a self-attention mechanism for predicting tool call tendency. Extract time-dependent features from the historical tool call sequence through the sequence recommendation model to obtain tool usage habit scores that characterize tool call preference for each candidate tool in the tool set. S300. Based on the semantic similarity between the received current task instruction and the functional description information of each tool in the tool set, determine the semantic similarity score that reflects the task relevance. S400. The tool usage habit score and the semantic similarity score are weighted and fused to obtain a comprehensive score. Based on the comprehensive score, a candidate tool set is selected from the tool set for the large language model to call and execute.

2. The method of claim 1, wherein, The S200 includes: The historical tool call sequence is embedded and encoded to obtain a sequence embedding vector. Based on the sequence embedding vector, the unique identifier of each tool in the historical tool call sequence is mapped to a feature representation in a continuous vector space to preserve the temporal position information of the tool call. The sequence embedding vector is input into the self-attention layer of the sequence recommendation model. The self-attention layer captures the temporal dependency of the tool call order in the historical tool call sequence and outputs the tool usage habit score. The temporal dependency represents the influence of the order of tools in the historical call sequence on the subsequent tool selection tendency.

3. The method of claim 1, wherein, The S300 includes: The current task instruction is semantically encoded using a pre-trained language model to obtain an instruction semantic vector, which is used to characterize the semantic features of the current task intent. The pre-trained language model is used to semantically encode the functional description information of each tool in the tool set to obtain a tool semantic vector; the tool semantic vector is used to characterize the functional semantic features of each tool in the tool set. The similarity between the instruction semantic vector and the tool semantic vectors of each tool in the tool set is calculated as the semantic similarity score; the semantic similarity score is used to characterize the instant matching relationship between the current task intent and the functional description information of each tool in the tool set.

4. The method according to claim 1, characterized in that, The S400 includes: The tool usage habit score and the semantic similarity score are weighted and fused to obtain the comprehensive score of each candidate tool in the tool set; wherein, the comprehensive score is used to jointly evaluate the adaptability of each candidate tool in the tool set from two complementary dimensions: historical calling behavior and current task intent. The weight of the tool usage habit score reflects the degree of influence of historical calling behavior on tool selection, and the weight of the semantic similarity score reflects the degree of influence of current task intent on tool selection. Candidate tools whose comprehensive scores meet the screening threshold conditions are identified as tools in the candidate tool set for the large language model to call and execute; the screening threshold conditions are used to eliminate candidate tools that are not relevant in either the historical call behavior dimension or the current task intent dimension.

5. The method according to claim 4, characterized in that, The weighted fusion of the tool usage habit score and the semantic similarity score to obtain the comprehensive score of each candidate tool in the tool set includes: The overall score for each candidate tool in the toolset is calculated according to the following formula: ; in, Let be the overall score of the i-th candidate tool. The tool usage habit score for the i-th candidate tool. Let be the semantic similarity score of the i-th candidate tool. The preference weight coefficient has a value range of [0,1] and is used to adjust the relative importance of the historical call behavior dimension and the current task intent dimension in the comprehensive evaluation. The screening threshold condition is: the comprehensive score of each candidate tool in the tool set is not lower than the preset screening threshold; the preset screening threshold is used to define the minimum adaptation standard of the candidate tool in the dimensions of historical call behavior and current task intent in order to eliminate candidate tools whose comprehensive scores in both dimensions do not meet the standard.

6. The method according to claim 2, characterized in that, The sequence recommendation model based on the self-attention mechanism is the SASRec model; the embedding encoding of the historical tool call sequence to obtain the sequence embedding vector includes: The unique identifiers of each tool in the historical tool call sequence are embedded and encoded through the embedding layer of the SASRec model to obtain the embedding vectors corresponding to the unique identifiers of each tool, and the embedding vectors corresponding to the unique identifiers of each tool are combined into the sequence embedding vector.

7. The method according to claim 6, characterized in that, The step of inputting the sequence embedding vector into the self-attention layer of the sequence recommendation model, capturing the temporal dependency of the tool call order in the historical tool call sequence through the self-attention layer, and outputting the tool usage habit score includes: The sequence embedding vector is self-attentionally calculated by the self-attention layer of the SASRec model to capture the temporal dependency of the tool call order in the historical tool call sequence, and a sequence representation vector is obtained. The sequence representation vector is used to aggregate the temporal context information of each tool call in the historical call sequence to form an overall representation of the tool usage habits of the target object. Based on the similarity between the sequence representation vector and the tool embedding representation of each candidate tool in the tool set, the tool usage habit score is obtained; the tool embedding representation is the vector representation of each candidate tool in the tool set in the SASRec model for preference matching calculation with the sequence representation vector.

8. The method according to claim 3, characterized in that, The pre-trained language model is a BERT model; The calculation of the similarity between the instruction semantic vector and the tool semantic vectors of each tool in the tool set, as the semantic similarity score, includes: Calculate the cosine similarity between the instruction semantic vector and the tool semantic vectors of each tool in the tool set; the cosine similarity is used to measure the directional proximity of the task intent and the tool function in the semantic feature space to reflect their semantic correlation. The cosine similarity is normalized to obtain the semantic similarity score; the normalization process is used to map the similarity value to a preset numerical range to unify the comparison benchmark of the semantic similarity scores of each tool in the tool set.

9. The method according to claim 1, characterized in that, After selecting the candidate toolset, the following is also included: The context information of the current task is obtained through the large language model, and the target tool required for the current step is determined from the candidate tool set and executed based on the context information; wherein, the context information includes the current task instruction and the results of previous tool calls obtained during the sequential execution of the current task; After obtaining the execution result of the target tool, the context information is updated based on the execution result, and the target tool required for the next step is determined from the candidate tool set and executed according to the updated context information; Repeat the steps of determining the target tool required for the current step from the candidate toolset and invoking its execution until the current task is completed.

10. A large-model toolchain scheduling system based on toolset optimization, characterized in that, The system is configured to execute the large model toolchain scheduling method based on toolset optimization as described in any one of claims 1 to 9.