Method and device for calling function by large model and medium

By combining function call classification and clustering compression methods with semantic features and context features, the problem of inefficient function call processing in the existing technology is solved, and efficient function call processing and response speed is improved.

CN120541352AActive Publication Date: 2025-08-26ZHONGZHI AIAITONG (NANJING) INFORMATION TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511046975.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-29
Publication Date
2025-08-26
Estimated Expiration
2045-07-29

AI Technical Summary

Technical Problem

When the prior art deals with a large number of function calls, especially in multi-plugin, agent collaboration or multi-window context scenarios, the calculation and response delays have increased significantly, resulting in system performance bottlenecks and user experience degradation. The existing clustering methods fail to effectively optimize the classification and clustering of function calls, resulting in information loss and inaccurate classification.

Method used

By combining semantic features, context features and multi-label classification mechanisms, the feature recognition model and aggregation strategy model are used to accurately classify function calls, and a reward evaluation function and policy aggregator are introduced. The reinforcement learning mechanism is used to optimize the clustering effect, reduce calculation overhead and improve response speed.

Benefits of technology

It significantly improves the processing efficiency and response speed in large-scale function call scenarios, reduces the computing burden of computing devices, and improves resource utilization and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120541352A_ABST
    Figure CN120541352A_ABST
Patent Text Reader

Abstract

The invention relates to a method and equipment for calling a function by a large model and a medium. The method comprises the following steps: acquiring original function calling used for calling a large model context protocol server; determining scene features called by the original function by using a feature recognition model; classifying the original function call into a to-be-reserved function call and a to-be-compressed function call based on the scene features and the original function call by utilizing an aggregation strategy model; executing clustering on the to-be-compressed function call by utilizing a clustering compression model so as to obtain clustered function call; and injecting the to-be-reserved function call and the clustered function call into a large model for call.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a method, device and medium for calling a function using a large model. Background Art

[0002] In modern large-scale computing systems and artificial intelligence applications, processing large numbers of function calls and contextual information has become a challenge. With technological advancements, many fields, particularly in benefit recommendations, intelligent customer service, and scenarios involving multiple plug-ins and agents, require real-time processing of thousands of function calls, often containing complex contextual information. Traditional methods rely on simple rules or matching based on static, predefined patterns to process function calls. However, this approach cannot effectively address the performance bottlenecks brought about by massive amounts of data and the dynamic changes in contextual information.

[0003] Existing technologies commonly use a context-based protocol (MCP) to pass function calls to large language models (such as GPT and Claude). These models structure multi-dimensional information, such as user instructions, historical conversations, task objectives, and system prompts, before passing it to the model interface. While this approach improves the model's flexibility and responsiveness to a certain extent, the rapid increase in the number of connected MCP tools has led to a rapid expansion in the number of function calls passed to the model. This is particularly true in scenarios involving multiple plug-ins, collaborative agents, or multi-window contexts, where each call can include hundreds or even thousands of function calls. This significantly increases system computation and response latency, severely impacting system performance and user experience.

[0004] In particular, in scenarios like welfare recommendation or planning, certain tasks require models to continuously and iteratively search for optimal solutions. This causes function calls to accumulate over long loops, resulting in significant token consumption and performance loss. Existing solutions fail to effectively optimize the classification and clustering of function calls, leading to inefficiencies in handling high-frequency and large-scale function calls.

[0005] To address these issues, the industry has proposed a technical solution called function call clustering and compression. This solution uses a clustering algorithm to group similar function calls, reducing the number of function calls processed and, in turn, computational complexity. However, existing clustering methods are typically based on static feature extraction and clustering rules, failing to fully account for the volatile context and dynamic nature of function calls. This results in suboptimal clustering results in some scenarios, and in practical applications, is prone to information loss and inaccurate classification. Summary of the Invention

[0006] To address the above problems, the present invention proposes a dynamic optimization method based on a clustering compression model, which aims to accurately classify and optimize the function calls to be compressed by combining semantic features, contextual features and a multi-label classification mechanism, thereby effectively reducing the system's computational overhead and improving the processing efficiency and response speed of function calls.

[0007] In addition, the present invention introduces a reward evaluation function and a strategy aggregator, and adopts a reinforcement learning mechanism in the process of function call compression to further optimize the clustering effect and improve the adaptability and performance of the system in large-scale function call scenarios.

[0008] According to a first aspect of the present disclosure, a method for calling a function of a large model is provided, characterized in that the method includes: obtaining an original function call for calling a large model context protocol server; using a feature recognition model to determine the scenario features of the original function call; using an aggregation strategy model to classify the original function call into a function call to be retained and a function call to be compressed based on the scenario features and the original function call; using a clustering compression model to cluster the function call to be compressed to obtain a clustered function call; and injecting the function call to be retained and the clustered function call into the large model for calling.

[0009] In one or more methods, using a feature recognition model to determine the scenario features of the original function call includes: obtaining historical data about the scenario features; constructing a feature recognition model based on the obtained historical data using a pre-trained language model; using the feature recognition model to determine one or more semantic features of the original function call; using a multi-label classification head to determine the label probabilities of the one or more semantic features of the original function call; and determining the scenario features of the original function call based on the determined label probabilities.

[0010] In one or more methods, clustering the function calls to be compressed using a clustering compression model includes: using a feature recognition model to obtain semantic features and context features about the function calls to be compressed; combining the semantic features and the context features to obtain an input vector passed to the clustering compression model; based on a template induction model, summarizing the semantic features to obtain a standardized function call template; and based on the formed function call template, using a clustering compression model to perform clustering processing on the input vector to obtain clustered function calls.

[0011] In one or more methods, clustering the input vector using a cluster compression model further comprises: determining an importance parameter of the original function call for optimizing cluster compression quality using a reinforcement scoring function.

[0012] In one or more methods, determining importance parameters of the original function calls for optimizing cluster compression quality using a reinforcement scoring function includes: determining a reward function and a penalty function in the reinforcement scoring function; constructing a reward evaluator based on the determined reward function and penalty function; and adjusting a clustering strategy of a cluster compression model using the reward evaluator to obtain clustered function calls.

[0013] In one or more methods, utilizing an aggregation policy model, based on the scenario features and the original function call, classifying the original function call into a function call to be retained and a function call to be compressed includes: utilizing a feature recognition model to obtain semantic features and context features about the original function call; based on the semantic features and context features, the policy aggregator generates a priority policy according to the semantic features and context information of the function call to be compressed; based on the priority policy, classifying the original function call into a function call to be retained and a function call to be compressed.

[0014] In one or more methods, an aggregation strategy model includes a Transformer model and a multi-layer perceptron, wherein the Transformer model is configured to transmit semantic features and context features of the original function call; and the multi-layer perceptron is configured to calculate the classification probability of the function call, thereby determining the priority strategy of the function call.

[0015] According to a second aspect of the present disclosure, a computing device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor so as to enable the at least one processor to execute the method of the first aspect of the present disclosure.

[0016] In a third aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute the method of the first aspect of the present disclosure.

[0017] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements.

[0019] Figure 1 A schematic diagram of a system for implementing a large model calling function method according to an embodiment of the present disclosure is shown.

[0020] Figure 2 FIG. 4 is a flowchart of a large model calling function method 200 according to an embodiment of the present disclosure.

[0021] Figure 3 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0022] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0023] As used herein, the term "including" and its variations represent open inclusion, i.e., "including but not limited to." Unless otherwise stated, the term "or" means "and / or." The term "based on" means "based at least in part on." The terms "an example embodiment" and "an embodiment" mean "at least one example embodiment." The term "another embodiment" means "at least one additional embodiment." The terms "first," "second," etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0024] Figure 1 FIG. 1 shows a schematic diagram of a system for implementing a large model calling function method according to an embodiment of the present disclosure. Figure 1 As shown in FIG, the system includes a computing device 110, a network management device 130, and a network 140. The computing device 110 and the network management device 130 can exchange data through the network 140 (eg, the Internet).

[0025] Computing device 110 is used to receive raw function call data, perform function call classification, clustering, and compression operations, and pass the results to the large model. Computing device 110 may include one or more processing units, such as a CPU, GPU, or FPGA, and may also be a desktop computer, laptop, or tablet computer. Computing device 110 is responsible for processing the function call data received from network management device 130 and executing the various functions in the method.

[0026] Network management device 130 manages the large model context protocol server (MCP server) and performs preliminary processing on function call data received from computing device 110. Network management device 130 exchanges data with computing device 110 via network 140, performing function call classification, compression, and optimization. This device includes dedicated hardware processing units, such as GPUs and ASICs, responsible for efficiently executing model training and inference operations.

[0027] The network 140 is used to connect the computing device 110 and the network management device 130 to transmit data and model information. The network 140 can be the Internet or a local area network, and is used to support remote computing and data interaction of large model call functions.

[0028] The computing device 110 receives raw function call data from the network management device 130. These raw function calls contain instructions and parameters that the large model needs to process. Raw function calls typically include multi-dimensional information, such as user input, historical conversation records, task objectives, and system prompts.

[0029] The computing device 110 performs scenario feature analysis on the original function call through the feature recognition model. The feature recognition model extracts semantic features and contextual features related to the current task based on the content of the original function call. For example, if the call involves welfare recommendations, the model can identify the scenario feature of "holiday welfare". The computing device 110 uses the aggregation strategy model to classify the function call as "function call to be retained" or "function call to be compressed" based on the extracted scenario features and the content of the original function call. This step uses the aggregation strategy model to judge the priority of the function call and ensure that important function calls are not compressed. For function calls marked as to be compressed, the computing device 110 performs clustering operations using the clustering compression model. The clustering compression model analyzes the similarity features between the function calls to be compressed and aggregates them into representative calls, thereby reducing redundant information and compressing the number of function calls. This process greatly improves the efficiency of system processing.

[0030] Finally, computing device 110 injects the to-be-retained function calls and the clustered and compressed function calls into the large model for final processing. The large model then performs tasks based on these function calls, such as generating responses or executing specific operations. This allows the system to efficiently process large amounts of function call data and reduce computational overhead.

[0031] The network management device 130 receives function call requests from external systems or users via the network 140 and transmits the original function calls to the computing device 110. The computing device 110 processes the original function calls, first extracting scenario features using a feature recognition model, then classifying the function calls using an aggregation strategy model, ultimately deciding which function calls need to be retained and which can be compressed. For function calls to be compressed, the computing device 110 performs clustering operations using a clustering compression model and generates compressed function calls. Finally, the computing device 110 injects all processed function calls into the large model. The large model responds based on these optimized function calls, completing user requests or executing designated tasks.

[0032] By implementing this method, computing device 110 can significantly improve the efficiency of large models when processing large numbers of function calls. Through precise classification and compression operations, computing device 110 reduces unnecessary computation and memory consumption, thereby improving the responsiveness and performance of large models. This optimization method is applicable to various scenarios requiring complex context handling and high-frequency function calls, effectively reducing the computational load on computing device 110 and improving resource utilization.

[0033] Note that computing device 110 may include one or more processing units, including specialized processing units such as GPUs, FPGAs, and ASICs, as well as general-purpose processing units such as CPUs. Furthermore, one or more virtual machines may also be running on each computing device 110. In some embodiments, computing device 110 and network management device 130 may be integrated or separately configured.

[0034] Figure 2 FIG. 2 shows a flow chart of a large model calling function method 200 according to an embodiment of the present disclosure. The method 200 may be performed as follows: Figure 1 The computing device 110 shown is executed, and may also be executed on Figure 3 The method 200 is executed at the electronic device 300. It should be understood that the method 200 may further include additional blocks not shown and / or may omit the blocks shown, and the scope of the present disclosure is not limited in this respect.

[0035] In step 202, the original function call for the large model context protocol server call is obtained.

[0036] In one embodiment, raw function call data may be received from an external system and passed to a Large Model Context Protocol server (MCP server) for further processing.

[0037] In practical applications, raw function calls typically come from multiple input sources, such as user requests, historical conversation records, task goals, or instructions from external systems. These input sources may include multiple different types of data, such as text, commands, and parameter settings. For example, in an intelligent customer service scenario, a user may submit requests such as "Query holiday benefits" or "Get reimbursement procedures" to computing device 110. Computing device 110 needs to convert these requests into raw function calls and pass them to the large model context protocol server.

[0038] First, the computing device connects to an external system (such as a user terminal or business system) via a network and receives user requests. For each user request, the computing device 110 parses it into a corresponding primitive function call. For example, if a user requests "Query holiday benefits," the computing device 110 parses this request into a primitive function call containing information such as the query task, task type (holiday benefits), and parameters (such as date, user identity, etc.). This parsed function call data typically includes multiple fields, such as: Function name: Indicates the function being called (such as "Query Benefits").

[0039] Parameters: include the specific data required for the function call (such as "holiday" type, query date, user information, etc.).

[0040] Contextual information: such as the user's current request context, historical conversation content, or task goals, helps the large model understand the background information of the function call.

[0041] The computing device transmits this raw function call data to the large model's context protocol server via a network protocol. The large model context protocol server is responsible for receiving these function calls and processing them according to the rules set by the computing device 110. The context protocol server performs context matching on the incoming raw function calls and further formats them into a structure recognizable by the large model for use in subsequent task processing.

[0042] In some application scenarios, multiple raw function calls may be received simultaneously, and these calls may contain multi-dimensional, complex information. For example, in a scenario where multiple plug-ins work together, a user request may involve multiple independent function calls. In this case, computing device 110 needs to decide how to pass these function calls to the large model based on the priority and task type of each function call to ensure effectiveness and efficiency in subsequent processing.

[0043] Finally, after receiving these raw function calls, the large model context protocol server performs further classification, feature extraction, or aggregation according to predefined processing rules, passing the function calls to subsequent model components for specific processing. In this way, the raw function call data is efficiently organized and passed to the large model, providing a foundation for the model's subsequent decisions and operations.

[0044] In step 204, the scene features of the original function call are determined using a feature recognition model.

[0045] In one embodiment, a feature recognition model can be used to determine the contextual characteristics of the original function call. This process includes obtaining contextual characteristic information from historical data, building a feature recognition model using a pre-trained language model, and determining the semantic features of the original function call based on a multi-label classification head. Through these steps, computing device 110 can accurately identify the application context of the original function call, thereby helping the large model make more accurate decisions during subsequent processing.

[0046] Scenario features can be acquired by collecting historical data. Historical data includes past function call records, task objective information, user interaction records, and more. This data helps the feature recognition model understand the characteristics of each scenario and the behavioral patterns of original function calls in different scenarios. For example, in a benefits recommendation system, historical data might include different users' holiday benefit query records and reimbursement process query records. By analyzing this historical data, computing device 110 can provide rich contextual information for the feature recognition model.

[0047] Computing device 110 uses a pre-trained language model based on historical data to build a feature recognition model. Pre-trained language models are typically trained using large-scale text datasets and can effectively capture the semantic and contextual information in text. In this embodiment, the feature recognition model is fed with function call samples from historical data and, combined with the knowledge from the pre-trained language model, automatically extracts semantic and contextual features associated with each original function call. For example, the pre-trained model can identify the relevance of a function call to scenarios such as holiday benefits and reimbursement processes.

[0048] Using these semantic features, the feature recognition model further determines the contextual characteristics of the original function call. Computing device 110 analyzes the content of the function call and extracts one or more key semantic features. These semantic features represent the specific context of the original function call, such as "holiday benefits" or "reimbursement process." Based on these features, computing device 110 can accurately label the function call and classify it into the corresponding application scenario.

[0049] Based on this, computing device 110 uses a multi-label classification head to predict label probabilities for the semantic features of each original function call. Based on the semantic features extracted by the feature recognition model, the multi-label classification head calculates the probability of each scenario label. For example, computing device 110 may calculate that the probability of the label "holiday benefits" is 0.8, and the probability of the label "reimbursement process" is 0.2. These probabilities reflect computing device 110's confidence level in each scenario label, helping computing device 110 determine which label is most appropriate for the current function call.

[0050] Finally, based on the probabilities of these labels, computing device 110 can accurately determine the contextual characteristics of the original function call. This determination process is based not only on label probabilities but also incorporates the contextual information of the function call to ensure accurate identification of the contextual characteristics. For example, if the probability of the label "holiday benefits" is high, computing device 110 will classify the function call as a holiday benefits query scenario and perform appropriate processing.

[0051] In a specific application scenario, suppose a user requests to "check whether there will be additional subsidies for next year's Spring Festival." Computing device 110 needs to determine the scenario characteristics of this function call. Computing device 110 first obtains historical data related to this scenario, which may include the user's past benefit inquiries and historical data on holiday benefits. Next, computing device 110 processes the request using a pre-trained language model, extracting semantic features such as "Spring Festival" and "subsidy." Based on these features, the feature recognition model determines that the request belongs to the scenario of a holiday benefit inquiry.

[0052] Computing device 110 can use the multi-label classification head to predict the "Spring Festival benefits" label and calculate the label probability values. If the probability of the "Spring Festival benefits" label is 0.9 and the probability of the "other benefits" label is 0.1, computing device 110 will ultimately determine that the scenario characteristics of the function call are "holiday benefits" queries and pass the call to the processing module of the large model for further processing.

[0053] Through the above embodiments, the computing device 110 can accurately identify the application scenario corresponding to the original function call, provide an important basis for subsequent function call classification, clustering and compression, and ultimately improve the processing efficiency and response speed of the computing device 110.

[0054] In step 206, the aggregation strategy model is used to classify the original function call into a function call to be retained and a function call to be compressed based on the scenario characteristics and the original function call.

[0055] This embodiment describes the specific steps for using an aggregation policy model to classify original function calls as those to be retained or compressed based on scenario features and the original function calls. This process is implemented using a feature recognition model, a policy aggregator, and an aggregation policy model (including a Transformer model and a multi-layer perceptron). In this way, computing device 110 can flexibly determine which function calls to retain and which to compress in large-scale function call scenarios, thereby improving computing efficiency and reducing the burden on computing device 110.

[0056] First, the computing device uses a feature recognition model to extract semantic and contextual features from the original function call. These features are obtained by analyzing the content of the original function call. Semantic features can include task type, parameter information, and scenario tags, while contextual features include the current user's historical interaction information and the context of the current request. For example, in a benefits recommendation system, semantic features might include "holiday benefits" and "reimbursement process," while contextual features might include the user's past benefits inquiry records or current task objectives. The feature recognition model passes this information to the subsequent aggregation strategy model for classification processing.

[0057] Next, based on the extracted semantic and contextual features, the policy aggregator generates a corresponding priority policy. Specifically, the policy aggregator uses these features to evaluate the priority of function calls and assigns them to different categories based on the evaluation results. For function calls to be compressed, the policy aggregator decides whether to compress them based on their priority and contextual information. This process, through in-depth analysis of the semantic information of function calls, ensures that the compression policy does not lose important information and prioritizes those function calls that are critical to the task.

[0058] During this process, the aggregation policy model uses a combination of the Transformer model and a multi-layer perceptron (MLP) to further optimize the classification of function calls. The Transformer model is configured to transmit the semantic and contextual features of the original function calls. The Transformer can deeply process the input features through its self-attention mechanism to capture global contextual relationships and semantic dependencies, ensuring that the contextual information of each function call is fully transmitted. The multi-layer perceptron (MLP) is responsible for calculating the classification probability of each function call and generating a priority policy based on these probabilities. Specifically, the MLP calculates the probability of each function call belonging to the class to be retained or the class to be compressed based on the input features, providing a decision basis for the policy aggregator.

[0059] Finally, based on the calculated priority policy, computing device 110 classifies the original function call as a "function call to be retained" or a "function call to be compressed." The function call to be retained will continue to be used in subsequent processing, while the function call to be compressed will be merged, simplified, or excluded to reduce the computing overhead of computing device 110.

[0060] In a specific application scenario, assuming that a user requests to "check whether there are additional subsidies during the Spring Festival", the computing device 110 needs to classify the original function call into a function call to be retained or a function call to be compressed through the above process.

[0061] First, the computing device uses a feature recognition model to extract semantic features of the request, such as "Spring Festival benefits" and "subsidy." Contextual features include the user's past benefit query history and task objectives (for example, querying for benefits related to holidays). The computing device then passes these features to the policy aggregator, which uses them to assess the request's priority.

[0062] Next, the policy aggregator passes semantic and contextual features through the Transformer model for deep processing, capturing the holiday-related semantic information and context in the request. Based on the processed features, the MLP model calculates the probability that the function call belongs to the "holiday benefits" category and determines its priority. If the request is considered high priority (for example, the user has not recently searched for relevant information and the request is very important in the current task), the request is marked as a function call to be retained; otherwise, if the request is considered redundant (for example, the user has searched for the same information multiple times), the request is classified as a function call to be compressed.

[0063] Based on the priority policy, the computing device 110 classifies the original function call as to be retained or to be compressed, and provides input for subsequent processing. This ensures that the computing device 110 can flexibly handle function calls in different scenarios and improves overall efficiency.

[0064] In step 208, clustering is performed on the function calls to be compressed using a clustering compression model to obtain clustered function calls.

[0065] The clustering compression model can be used to perform clustering processing on the function calls to be compressed. This process includes obtaining the semantic features and context features of the function calls to be compressed, normalizing them using a template induction model, optimizing the clustering using the clustering compression model, and adjusting the clustering strategy through an enhanced scoring function to obtain the final clustered function calls.

[0066] Computing device 110 uses a feature recognition model to obtain semantic and contextual features of the function calls to be compressed. Semantic features may include information such as keywords, parameters, and task objectives in the original function call, while contextual features include background information related to the function call, such as historical user interactions, current task status, and scenario tags. By deeply analyzing the function calls to be compressed, the feature recognition model can extract this important information that facilitates classification and clustering.

[0067] Computing device 110 combines the extracted semantic features and contextual features to generate an input vector. These features are concatenated into a multidimensional vector and passed as input to the clustering compression model for subsequent clustering operations. In this way, the clustering compression model can perform clustering based on comprehensive feature information, ensuring that the clustered function calls fully reflect the needs of different tasks and scenarios.

[0068] The template induction model summarizes the extracted semantic features. By learning from a large amount of function call data, the template induction model automatically generates standardized function call templates. These templates help the system standardize the formats of different function calls, reducing their diversity and complexity and making the clustering process more efficient. Through template induction, the system ensures semantic consistency across different function calls, thereby improving the effectiveness of the clustering compression model.

[0069] During the clustering process, computing device 110 clusters the generated input vectors using a clustering compression model. The clustering compression model groups function calls to be compressed based on the similarity of the input vectors, ensuring that similar function calls are grouped together, thereby reducing redundancy and computational overhead. Each group of similar function calls is compressed into a single representative call, reducing unnecessary computation and improving processing efficiency.

[0070] To further optimize cluster compression quality, the system introduces a reinforcement scoring function to determine the importance parameters of each original function call. This reinforcement scoring function evaluates clustering quality by setting a reward function and a penalty function. The reward function rewards function calls that effectively preserve important information, while the penalty function penalizes function calls that lose important information or generate information conflicts. Through this comprehensive evaluation of rewards and penalties, the system optimizes the clustering strategy, ensuring that the clustering process is efficient while preserving important semantic information.

[0071] Based on the determined reward and penalty functions, the system constructs a reward evaluator. This reward evaluator dynamically adjusts the clustering strategy of the cluster compression model based on the output of the reinforcement scoring function. This adjustment enables the clustering model to be optimized at each iteration based on historical data and real-time feedback, resulting in more accurate and effective function call compression results.

[0072] The reward function optimizes the quality of compressed function calls based on compressed function call information and human preference scores. The reward function includes the following components: Token Saving, Semantic Coverage, and Conflict Penalty. Token Saving represents the number of tokens reduced after compression, Semantic Coverage represents the degree of coverage of the original intent after compression, and Conflict Penalty represents the penalty for information conflicts caused by clustering errors. Finally, computing device 110 obtains clustered function calls based on the optimized clustering strategy. These clustered function calls can effectively reduce the system's computational burden and improve the model's responsiveness and processing efficiency.

[0073] Specifically, the reward function can be expressed as: R = w1 * Token_Saving + w2 * Semantic_Coverage - w3 * Conflict_Penalty Token_Saving represents the number of tokens saved by the compressed function call compared to the original function call. w1 is the token saving weight vector awaiting training. Semantic_Coverage represents whether the compression result accurately covers the original intent (e.g., this can be measured using metrics like BERTScore). w2 is the intent weight vector awaiting training. Conflict_Penalty represents whether ambiguity is introduced (e.g., different holidays are lumped together). w3 is the conflict penalty weight vector awaiting training.

[0074] In one embodiment, suppose the system is processing a user request asking for additional allowances during the 2022 Spring Festival. Computing device 110 first uses a feature recognition model to extract semantic features of the request, such as "Spring Festival benefits" and "allowances," as well as contextual features such as the user's historical query history and task objectives. These features are then passed to a clustering and compression model, where computing device 110 generates an input vector, which is then normalized using a template induction model.

[0075] During the clustering process, computing device 110 optimizes clustering results by strengthening the scoring function. First, a reward function assigns a score based on whether the compressed function call retains the key information about "Spring Festival benefits." A penalty function then applies a penalty based on whether the relevant allowance information is lost. The system uses a reward evaluator to adjust the clustering strategy, ensuring that the resulting compressed function call not only reduces redundant information but also retains all key information.

[0076] Ultimately, the request is clustered into a representative function call and injected into the larger model for subsequent processing. Through this process, the system can efficiently handle a large number of function calls while retaining important context and semantic information, improving the system's processing power and efficiency.

[0077] Through the technical solution of this embodiment, a computing device can effectively utilize a clustering compression model and an enhanced scoring function to cluster function calls to be compressed. By combining semantic features, contextual features, and a template induction model, the system can reduce redundant information and optimize the clustering effect of function calls. Furthermore, the introduction of an enhanced scoring function provides dynamic adjustment capabilities for the clustering process, ensuring that key information is retained during compression for each function call, ultimately improving the system's processing efficiency and responsiveness.

[0078] In step 210 , the to-be-retained function calls and the clustered function calls are injected into the large model for calling.

[0079] In one embodiment, computing device 110 obtains the categorized function calls from the previous step. After processing by the aggregation strategy model, the function calls to be retained are marked as high priority and reserved for subsequent processing. Simultaneously, the function calls compressed by the clustering compression model are marked as function calls to be compressed and compressed into representative function calls. These two types of function calls are stored in separate queues, ready for injection into the larger model.

[0080] Computing device 110 organizes and sorts these two types of function calls—those to be retained and those that have been clustered—according to a specific strategy. Due to their higher priority, the to-be-retained function calls are typically placed in a priority processing queue, while the clustered function calls are placed in a corresponding compression queue. During this process, the system ensures the timeliness of the to-be-retained function calls, prioritizing them for delivery to the large model to enable faster response to user requests. Compressed function calls, by reducing the number of calls, reduce the computational burden on the large model, further improving its operational efficiency.

[0081] Computing device 110 injects the organized function calls (including those to be retained and those that have been clustered) into the input interface of the large model. After receiving these function calls, the large model uses its deep learning capabilities to process them and generate responses. For example, in an intelligent customer service system, the large model returns the results of user queries based on these function calls, such as the query "Are there additional allowances during the Spring Festival?" or the relevant steps of the "reimbursement process."

[0082] During this process, computing device 110 ensures that the large model can flexibly adjust the processing order based on the priority and processing requirements of each function call. For example, pending function calls are processed first by the large model to ensure timely responses to critical user requests, while clustered function calls are processed without impacting system performance. This strategy ensures efficient use of computing resources while ensuring accurate and timely responses.

[0083] Suppose the system is processing a series of user query requests. These include "Query whether there are additional allowances during the 2022 Spring Festival" and "View the reimbursement process." Following the previous steps, the system has already processed these requests into pending function calls and clustered function calls. The first request, "Query whether there are additional allowances during the 2022 Spring Festival," is identified as an important pending function call and prioritized by the system. The second request, "View the reimbursement process," is considered a common query and is classified as a pending function call.

[0084] Computing device 110 places the two function calls into their respective queues and prioritizes the pending function calls by first injecting them into the large model for processing. Once the large model has processed the pending function calls, it proceeds to process the clustered function calls. This ensures that users receive timely and accurate responses while optimizing the use of computing resources.

[0085] Through the technical solution of this embodiment, the computing device can effectively inject classified and compressed function calls into the large model, thereby achieving efficient function call processing. Function calls to be retained are prioritized, ensuring that critical requests receive rapid responses, while clustered function calls are processed without affecting system performance, thereby improving overall computing efficiency and system response speed. This process not only optimizes the computational burden of the large model but also ensures a timely and accurate user experience.

[0086] In one embodiment, using method 200 as described above, assume the system is handling an intelligent customer service scenario. User queries involve multiple questions, such as "Is there an additional allowance for the Spring Festival?", "What are the items in the company's health checkup?", and "What are the Spring Festival holiday arrangements?" These queries involve multiple functional modules and services, typically requiring multiple function calls. Without compression, the system must process each query request individually, resulting in excessive consumption of computing resources and long response times.

[0087] First, a user submitted a query request: "Is there an additional allowance for the Spring Festival?", "What are the items in the company health checkup?", and "What are the Spring Festival holiday arrangements?" The computing device 110 receives the user's request through the system, converts these requests into raw function calls, and passes them to the Large Model Context Protocol server (MCP server).

[0088] These requests include three functions: "Allowance Query," "Physical Examination Item Query," and "Vacation Schedule Query." Each function call triggers multiple independent function requests. The original function call data may include the query type, parameters (such as date, user information), and historical user interaction records.

[0089] Computing device 110 processes these raw function calls using a feature recognition model. The feature recognition model extracts semantic features (e.g., "allowance query," "physical examination item query") and contextual features (e.g., user identity information, historical query history) for each function call. For example, for the query "Is there an additional allowance during the Spring Festival?", the feature recognition model identifies "Spring Festival" and "allowance" as semantic features and, combined with historical data, determines whether the user has previously searched for related information as a contextual feature.

[0090] After acquiring the semantic features and context features, the computing device 110 classifies these function calls using an aggregated policy model. The policy model classifies the function calls into "to-be-retained" and "to-be-compressed" based on their priority and context.

[0091] For example, the system identifies the query request for "Spring Festival allowance" as being more important to the current task and classifies it as a function call to be retained, giving it priority. Meanwhile, the query request for "Company Health Checkup Items" is marked as a function call to be compressed because it is frequent and similar, allowing it to be merged and compressed, reducing the computational burden.

[0092] For function calls to be compressed, the system uses a clustering compression model to further cluster them. The clustering compression model combines multiple similar function calls into a single representative function call based on their similarity characteristics, thus reducing unnecessary repeated calculations.

[0093] For example, the query "Spring Festival allowance" may have multiple variant queries, such as "whether red envelopes are issued" and "whether shopping cards are issued". The system uses a clustering compression model to compress these variant queries into a unified function call: "Spring Festival benefit query", thereby reducing redundancy in calculations.

[0094] To further optimize the clustering results, the system uses a reinforcement scoring function to evaluate the importance of each function call and dynamically adjusts the clustering strategy based on the evaluation results. The reinforcement scoring function determines the importance of each function call in the compression process based on the design of the reward function and penalty function.

[0095] If the compressed function call still retains the key information of the original request (such as "Spring Festival allowance" information), the reward function will give a higher score.

[0096] Penalty function: If compression results in loss of important information or confusion of semantics, the penalty function will reduce the compression quality.

[0097] In this way, the system can dynamically adjust the clustering compression model to ensure that each compression process retains important information as much as possible while reducing unnecessary computational burden.

[0098] Finally, the processed function calls to be retained and the clustered function calls are fed into the large model for final processing. The large model generates responses based on these inputs, such as returning results for the user query "Is there an additional allowance for the Spring Festival?" or items related to "Company health checkups."

[0099] When injecting function calls into the large model, the system ensures that the function calls to be retained are processed first, while the compressed function calls are processed step by step without affecting the results, thereby ensuring the overall response speed and processing efficiency of the system.

[0100] The above technical means can reduce the computational burden. By clustering compression models and classifying function calls, the system can reduce redundant function calls, greatly reducing the processing burden on computing devices. Especially in complex query scenarios, multiple similar function calls are compressed into a single function call, reducing the data transmission and computational operations for each function call. By prioritizing function calls to be retained and efficiently processing function calls to be compressed, the system can significantly improve processing speed while ensuring accuracy. Especially in the case of high concurrency requests, response time is greatly shortened and the user experience is significantly improved. The compression of function calls reduces the system's consumption of computing resources. Especially when faced with a large number of requests, the system can more efficiently utilize computing resources such as CPU and memory, avoiding resource waste.

[0101] Finally, by introducing a reinforcement scoring function and reward evaluator, the system ensures that key information is not lost in compressed function calls, and that compression quality can be dynamically optimized. This ensures the system's efficiency and accuracy, without losing important contextual information due to compression.

[0102] Figure 3 1 shows a schematic block diagram of an example electronic device 300 that can be used to implement an embodiment of the present disclosure. Figure 1 The computing device 110 shown may be implemented by an electronic device 300. Figure 3 As shown, electronic device 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 302 or loaded from a storage unit 308 into a random access memory (RAM) 303. Various programs and data required for the operation of electronic device 300 may also be stored in the random access memory 303. The CPU 301, the read-only memory 302, and the random access memory 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0103] Multiple components in the electronic device 300 are connected to the input / output interface 305, including: an input unit 306, such as a keyboard, a mouse, a microphone, etc.; an output unit 307, such as various types of displays, speakers, etc.; a storage unit 308, such as a magnetic disk, an optical disk, etc.; and a communication unit 309, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 309 allows the electronic device 300 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0104] The various processes and procedures described above, such as methods, may be executed by the central processing unit 301. For example, in some embodiments, the methods may be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 308. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 300 via the read-only memory 302 and / or the communication unit 309. When the computer program is loaded into the random access memory 303 and executed by the central processing unit 301, one or more actions in the methods described above may be performed.

[0105] The present disclosure relates to methods, apparatuses, systems, electronic devices, computer-readable storage media, and / or computer program products. The computer program products may include computer-readable program instructions for executing various aspects of the present disclosure.

[0106] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or raised-in-groove structure on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical wire.

[0107] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge computing devices. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0108] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, the state information of the computer-readable program instructions is used to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), so that the electronic circuit can execute the computer-readable program instructions, thereby implementing various aspects of the present disclosure.

[0109] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0110] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0111] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.

[0112] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart, can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0113] Those skilled in the art will appreciate that the present invention is not limited to the embodiments described above, and that the present invention may be implemented in many other forms without departing from its spirit and scope. Therefore, the examples and embodiments shown are to be considered illustrative rather than restrictive, and that the present invention may encompass various modifications and substitutions without departing from the spirit and scope of the present invention as defined in the appended claims.

Claims

1. A method for calling a function in a large model, characterized in that: The method comprises: Get the original function call for the large model context protocol server call; Determining the scene features of the original function call using a feature recognition model; Using an aggregation strategy model, based on the scenario characteristics and the original function call, the original function call is classified into a function call to be retained and a function call to be compressed; clustering the to-be-compressed function calls using a clustering compression model to obtain clustered function calls; and The to-be-retained function calls and the clustered function calls are injected into the large model for calling.

2. The method according to claim 1, characterized in that Determining the scenario features of the original function call using a feature recognition model includes: Obtain historical data about scene characteristics; Based on the acquired historical data, a feature recognition model is constructed using a pre-trained language model; Determining one or more semantic features of the original function call using a feature recognition model; Determining label probabilities of one or more semantic features of the original function call using a multi-label classification head; and Based on the determined label probability, a scenario feature of the original function call is determined.

3. The method according to claim 1, characterized in that The clustering of the to-be-compressed function calls using the clustering compression model comprises: Using a feature recognition model, semantic features and context features of the function call to be compressed are obtained; combining the semantic features and the contextual features to obtain an input vector passed to a clustering compression model; Based on the template induction model, the semantic features are summarized to obtain a standardized function call template; and Based on the formed function call template, clustering processing is performed on the input vector using a clustering compression model to obtain clustered function calls.

4. The method according to claim 3, characterized in that The performing clustering processing on the input vector using a cluster compression model further includes: using an enhanced scoring function to determine an importance parameter of the original function call for optimizing cluster compression quality.

5. The method according to claim 4, characterized in that The importance parameters of the original function call for optimizing cluster compression quality are determined using an enhanced scoring function including: Determine the reward function and penalty function in the reinforcement scoring function; Constructing a reward evaluator based on the determined reward function and penalty function; The reward evaluator is used to adjust a clustering strategy of a cluster compression model to obtain clustered function calls.

6. The method according to claim 1, characterized in that The utilizing the aggregation strategy model to classify the original function call into a function call to be retained and a function call to be compressed based on the scenario characteristics and the original function call includes: Using a feature recognition model, obtaining semantic features and context features about the original function call; Based on the semantic features and context features, the policy aggregator generates a priority policy according to the semantic features and context information of the function call to be compressed; Based on the priority policy, the original function calls are classified into function calls to be retained and function calls to be compressed.

7. The method according to claim 6, wherein The aggregation strategy model includes a Transformer model and a multi-layer perceptron. The Transformer model is configured to transmit semantic features and contextual features of the original function call; as well as The multilayer perceptron is configured to calculate the classification probability of the function call, thereby determining a priority strategy for the function call.

8. A computing device, characterized in that include: at least one processing unit; At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions, when executed by the at least one processing unit, causing the device to perform the steps of the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that A computer program is stored on a computer-readable storage medium, and when the computer program is executed by a machine, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Rust language document test automatic generation method and device based on large code model

    CN117951038A

  • LLM-based SAST vulnerability rapid analysis method, apparatus and device

    CN118427842A

  • Code generation model fine tuning method and device based on clustering and natural language strategy optimization algorithm

    CN118468982A

  • Context aggregation-based user problem optimization method and system, terminal and medium

    CN119918653A

  • Course learning and reinforcement learning driven dynamic optimal self-consistent clustering method

    CN120372315A