A model invocation method and system based on atomic capability abstraction and dynamic adaptation
By breaking down natural language tasks into standardized atomic capability units and automatically generating API request payloads, the problem of low speed and efficiency in calling large models in existing technologies is solved, achieving rapid adaptation and efficient calling.
Patent Information
- Application Number
- CN202611620274.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-20
- Publication Date
- 2026-11-17
AI Technical Summary
The existing technology requires manual coding for adding large models, which leads to low calling speed and efficiency, and cannot achieve fast "hot-swap" of models and a unified calling experience.
By breaking down complex natural language task requirements into standardized sequences of atomic capability units, and utilizing a pre-built capability-model mapping database and meta-template engine, API request payloads are automatically generated, dynamically adapting to calls from different large models.
It enables rapid adaptation to different large models without manual coding, improves calling speed and efficiency, supports multi-model combination and parallel execution, reduces response latency, and is easy to extend to new models.
Smart Images

Figure CN123114802A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of artificial intelligence data processing technology, and in particular to a model invocation method and system based on atomic capability abstraction and dynamic adaptation. Background Technology
[0002] Currently, large language model technology is developing rapidly, with a variety of outstanding models emerging both domestically and internationally, such as OpenAI's GPT series, Anthropic's Claude series, and domestic models like DeepSeek, Tongyi Qianwen, and Wenxin Yiyan. These large models demonstrate powerful atomic capabilities in tasks such as text generation, logical reasoning, and code writing.
[0003] To build complex intelligent applications, it is usually necessary to combine and call multiple large models from different vendors with different capabilities and focuses, mainly using the following two patterns: 1. Hard-coded adapter pattern: Developers write adapter code separately for each large model to be integrated (such as GPT-4o, DeepSeek-V2, etc.), responsible for converting business requirements into the API request format (such as JSON structure, parameter naming, authentication method) specified by the specific large model, and processing its return results; however, adding a new large model, such as switching from GPT-4o to DeepSeek, or adding Tongyi Qianwen, requires writing a lot of adaptation code, designing exclusive prompt word templates and repeated debugging, which usually takes several hours or even days, and cannot achieve fast "hot-swap" of models, resulting in low calling speed and efficiency.
[0004] 2. Unified API Gateway Mode: This mode provides a unified API access format, routing requests to different backend models within the gateway. However, this mode only converges the entry protocol; the capability descriptions and instruction conversion logic for each major model (e.g., how to request "Tongyi Qianwen" to summarize, and how to request "Wenxin Yiyan" to translate) still need to be completed by developers through hard coding or static configuration, resulting in lower call speed and efficiency.
[0005] Existing solutions are model-driven rather than intent-driven. When a user submits a complex task request (such as "summarize the main points of this article and reply in Chinese"), the system cannot automatically break it down into two atomic capabilities: "text summarization" and "Chinese translation," and then automatically select the most suitable model for each capability (e.g., use DeepSeek for summarization and Tongyi Qianwen for translation) and arrange the execution order. Furthermore, prompts and API call parameters are typically hard-coded, making it impossible to dynamically generate the optimal API request payload based on the specific context of the task and the model's interface description paradigm. Summary of the Invention
[0006] To address the technical problem of low calling speed and efficiency caused by the need for manual coding when adding large models in existing technologies, this invention proposes a model calling method and system based on atomic capability abstraction and dynamic adaptation. By decomposing complex natural language task requirements into standardized atomic capability unit sequences, and automatically generating fully adapted API request payloads for atomic capabilities according to the interface specifications of different candidate large models (such as DeepSeek and Tongyi Qianwen), the work of manually writing adapters is fundamentally eliminated, thereby improving the calling speed and efficiency of large models. To achieve the above objectives, the present invention provides the following technical solution: A model invocation method based on atomic capability abstraction and dynamic adaptation specifically includes the following steps: S1: Receive the task requirements uploaded by the user and abstract them into M standardized atomic capabilities to construct a directed task graph; M is a positive integer not less than 1; S2: Traverse each atomic capability of the task directed graph in the pre-built capability-model mapping database to determine the execution big model for each atomic capability; S3: Employs a meta-template engine to dynamically populate the task semantics and contextual information of atomic capabilities into the meta-template placeholders of the large execution model, and automatically generates API request payloads. S4: Send the API request payload in parallel or serial to the execution model to obtain the execution result, and output the execution result to the user.
[0007] Preferably, in S1, the standardized atomic capabilities are defined using capability description primitives, each capability description primitive including capability identifier, input / output mode, applicable model identifier, and minimum accuracy.
[0008] Preferably, the method for constructing the task-directed graph is as follows: A: Create a graph node for each atomic capability and assign it an auto-incrementing node number; B: Construct a directed graph of tasks based on the dependencies between the graph nodes: If two graph nodes have a sequential execution relationship, add a directed edge between the two graph nodes and set the input relationship of the later node to that of the earlier node; If two graph nodes are executed in parallel, then the input relationships of both graph nodes will be bound to the task requirements.
[0009] Preferably, step S2 includes the following steps: S2-1: Traverse each atomic capability of the task directed graph in the pre-built capability-model mapping database to obtain the performance indicators of each large model in each atomic capability dimension; S2-2: Eliminate large models with an accuracy less than the minimum accuracy, and only retain large models with an accuracy greater than or equal to the minimum accuracy as candidate large models for atomic capability. S2-3: Select the candidate model with the highest comprehensive score as the execution model.
[0010] Preferably, in step S2-1, the pre-built capability-model mapping database records the performance metrics and interface metadata of all registered large models in each atomic capability dimension; the performance metrics include accuracy, latency, cost, overall score, and constraints.
[0011] Preferably, step S3 includes the following steps: S3-1: Determine parameter values based on the current system load; parameters include temperature and maximum computing power; S3-2: Dynamically populate the task semantics and context information of atomic capabilities into the meta-template placeholders of the large execution model to automatically generate API request payloads; S3-3: After the data is populated, call the JSON Schema validator to verify whether the generated API request payload conforms to the API specification for executing large models; if yes, the verification passes and is sent for execution; otherwise, the verification fails.
[0012] Preferably, in step S3-1, if the load is below 30%, the parameter value is taken as the upper limit of the suggested range; if the load is above 70%, the parameter value is taken as the lower limit.
[0013] Preferably, it also includes a hot-plug mechanism for the model to be updated, specifically including the following steps: B1: Parse the parameters of the large model to be updated and verify the integrity of the large model; the parameters of the large model to be updated include the identifier, large model name, provider, calling address, capability array, and template array; B2: Check if the model name of the large model to be updated already exists in the capability-model mapping database; if not, insert the large model to be updated into the capability-model mapping database to form the updated large model; if so, update the existing large model according to the parameters of the large model to be updated to form the updated large model. B3: Retrieve the updated atomic capabilities and meta-templates supported by the large model and upload them to the pre-built capability-model mapping database.
[0014] Preferably, the parameters of the large model to be updated include the identifier, large model name, provider, calling address, capability array, and template array.
[0015] Preferably, in step S1, an intent understanding model is used to abstract the task requirements into M standardized atomic capabilities; the intent understanding model builds a three-head parallel prediction architecture on top of the BERT-base-chinese encoder, including a capability sequence generation head, a dependency relationship head, and a parameter slot filling head; the total loss function L is: L = L_seq + 0.5·L_dep + 0.3·L_slot Where L_seq is the sequence cross-entropy loss, L_dep is the dependency classification cross-entropy loss, and L_slot is the CRF negative log-likelihood loss.
[0016] Preferably, in step S3-1, the parameter values are predicted by a lightweight parameter adaptation network; the input of the lightweight parameter adaptation network is the capability ID embedding vector, the task original text statistical feature vector, and the current load features of the candidate model, and the output temperature and maximum computing power are obtained through two fully connected layers. The network is trained using the top 10% of the parameters in the historical call logs in terms of quality scores as supervision labels and mean squared error as the loss function.
[0017] Preferably, in step S2, a dual-tower matching network can also be used to perform matching of large models: First, the atomic capability ID is embedded and concatenated with the BERT encoding of the capability description text, and then mapped into a capability vector through a fully connected layer; Then, the performance metric vectors of the large model on each dimension benchmark are mapped to model vectors using MLP; Finally, the cosine similarity between the capability vector and the model vector is calculated and used as the matching score. The large model with the highest matching score is selected as the execution large model for the corresponding atomic capability.
[0018] Preferably, the task directed graph is serialized into JSON format and stored, including graph_id, nodes array, edges array and execution_order array; the nodes array includes node_id, ability_id and input_binding, the edges array includes from, to and type, and the execution_order array is a list of parallel groups; the JSON object is stored in the database and cached in Redis.
[0019] Preferably, before calling the intent understanding model, the user's task requirements are first matched with a pre-set high-frequency composite intent template library for similarity; if the similarity exceeds 0.95, the atomic capability sequence and dependencies corresponding to the template are directly adopted, skipping the intent understanding model parsing step.
[0020] Preferably, the standardized atomic capabilities are pre-defined into four categories: understanding, generation, processing, and advanced. The understanding category includes text summarization, sentiment analysis, entity extraction, intent classification, and keyword extraction. The generation category includes text continuation, text rewriting, multilingual translation, and code generation. The processing category includes format conversion, data extraction, and text proofreading. The advanced category includes thought chain reasoning, tool invocation, and multi-document integrated question answering.
[0021] This invention also provides a model invocation system based on atomic capability abstraction and dynamic adaptation, comprising: The data acquisition module is used to acquire the task requirements input by the user; The task abstraction module is used to abstract task requirements into at least one standardized atomic capability; The model matching module is used to traverse a pre-built capability-model mapping database based on standardized atomic capabilities to determine the execution big model for each atomic capability. The meta-template engine is used to dynamically populate the task semantics and contextual information of atomic capabilities into meta-template placeholders for executing large models, and automatically generate API request payloads. The output module is used to call and execute the large model, generate the execution results, and return them to the user.
[0022] In summary, by adopting the above technical solution, compared with the prior art, the present invention has at least the following beneficial effects: This invention automatically breaks down complex natural language task requirements uploaded by users into standardized atomic capabilities. Based on the interface specifications of different candidate large models (such as DeepSeek and Tongyi Qianwen), it automatically generates fully adapted API request payloads for the atomic capabilities, eliminating the need for manual coding for different candidate large models and improving the calling speed and efficiency of large models. This invention dynamically generates optimal prompts and parameters based on the task context, rather than simply replacing static templates. This helps to uncover the best performance of different models on specific tasks, while also achieving a unified calling experience across models.
[0023] This invention supports multi-model combination and parallel execution (such as parallel calls to DeepSeek and Tongyi Qianwen to process different subtasks), effectively reducing overall response latency. The architecture is easily extensible and can quickly adapt to new models that emerge in the future, improving its practicality. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of a model invocation method based on atomic capability abstraction and dynamic adaptation according to an exemplary embodiment of the present invention.
[0025] Figure 2A schematic diagram of the task-directed graph construction process according to an exemplary embodiment of the present invention.
[0026] Figure 3 This is a schematic diagram of the atomic capability execution model acquisition process according to an exemplary embodiment of the present invention.
[0027] Figure 4 A schematic diagram of the API request payload generation process according to an exemplary embodiment of the present invention.
[0028] Figure 5 A schematic diagram of a model invocation system based on atomic capability abstraction and dynamic adaptation according to an exemplary embodiment of the present invention. Detailed Implementation
[0029] The present invention will be further described in detail below with reference to embodiments and specific implementation methods. However, this should not be construed as limiting the scope of the above-described subject matter of the present invention to the following embodiments; all technologies implemented based on the content of the present invention fall within the scope of the present invention.
[0030] In the description of this invention, it should be understood that the terms "longitudinal", "lateral", "up", "down", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0031] like Figure 1 As shown, this invention provides a model invocation method based on atomic capability abstraction and dynamic adaptation, specifically including the following steps: S1: Receive the task requirements uploaded by the user and abstract them into M standardized atomic capabilities to construct a directed task graph; M is a positive integer not less than 1.
[0032] In this embodiment, the task requirements need to be described using natural language (such as Chinese, English, Arabic, etc.). The task requirements can be abstracted into at least one standardized atomic capability (such as text summarization, sentiment analysis, and Chinese translation) using a built-in intent understanding model (an existing basic model).
[0033] Furthermore, before invoking the intent understanding model, the user's task requirements are first matched with a pre-built library of high-frequency composite intent templates for similarity. If the similarity exceeds 0.95, the atomic capability sequence and dependencies corresponding to the template are directly used, skipping the intent understanding model parsing step and further reducing response latency.
[0034] Furthermore, the intent understanding model builds a three-head parallel prediction architecture on top of the BERT-base-chinese encoder: the capability sequence generation head adopts a Pointer Network mechanism, where the decoder selects a capability ID from a predefined vocabulary of 32 capabilities at each step and uses the output of the previous step as the input for the next step until the end marker is output, resulting in an ordered capability sequence; the dependency head adopts dual affine attention, which calculates the dependency score for the encoded representations h_i and h_j of any two capability positions using a learnable dual affine matrix and bias vector, and determines the dependency type as serial, parallel, or no dependency using softmax; the parameter slot filling head adopts a linear chain CRF, which identifies constraint phrases in user requirements and maps them to the parameter slots of the corresponding capability nodes.
[0035] The total loss function is: L = L_seq + 0.5·L_dep + 0.3·L_slot Where L_seq is the cross-entropy loss of the capability sequence, L_dep is the cross-entropy loss of dependency classification, and L_slot is the negative log-likelihood loss of CRF. The training data consists of manually labeled seed data, template augmentation data, and back-translation enhancement data, totaling approximately 50,000 data points.
[0036] The standardized atomic capabilities are defined using scalable capability description primitives.
[0037] Furthermore, the system comes pre-configured with 32 atomic capabilities, divided into four categories: understanding capabilities, including text summarization, sentiment analysis, entity extraction, intent classification, and keyword extraction; generation capabilities, including text continuation, text rewriting, multilingual translation, and code generation; processing capabilities, including format conversion, data extraction, and text proofreading; and advanced capabilities, including thought chain reasoning, tool invocation, and multi-document integrated question answering.
[0038] Each capability description primitive includes at least a capability identifier, input / output mode, applicable model family identifier, and minimum performance threshold (minimum accuracy). This decouples the system's understanding of "capabilities" from the specific "model".
[0039] For example, if a user inputs a task requirement of "analyze the sentiment of this article and summarize the key points", the built-in intent understanding model will parse the task requirement into two independent atomic capabilities, namely sentiment analysis and text summarization.
[0040] The example format for text summarization is as follows: Wherein, id represents the capability identifier; name represents the name of the atomic capability; category represents the capability category, indicating that it belongs to the "understanding" category; io_schema represents the input and output specifications; min_acc represents the minimum accuracy, which is the threshold for the large model to execute this atomic capability. If it is lower than this threshold, it means that the large model is not compatible with this atomic capability; prompt represents the role prompt word; fallback represents the fallback capability list. When text summarization fails, times out, the output does not conform to io_schema, or the accuracy is lower than min_acc, the system can try the text_extraction and text_compression capabilities in turn.
[0041] In this embodiment, a task-directed graph representing the execution order of multiple standardized atomic capabilities is constructed based on task logic, such as... Figure 2 As shown, it includes the following steps: A: Create a graph node for each atomic capability and assign it an auto-incrementing node number, such as node 0 and node 1.
[0042] B: Construct a directed graph of tasks based on the dependencies between the graph nodes.
[0043] If two graph nodes have a sequential execution relationship, add a directed edge and set the input relationship of the subsequent node to that of the preceding node; if two graph nodes have a parallel execution relationship, bind both to task requirements; and construct the task directed graph.
[0044] For example, nodes 0 and 1 have a sequential execution relationship: the user's task requirements become the input for node 0, and the output of node 0 becomes the input for node 1. Because node 1 depends on the output of node 0, it must wait for node 0 to complete before executing node 1. Therefore, a first directed edge is added between the task requirements and node 0, and a second directed edge is added between node 0 and node 1.
[0045] Specifically, for the user input "summarize this article and reply in Chinese", it is decomposed into sequentially executed nodes A (text summary) and B (Chinese translation), constructing a directed graph A→B. The system first selects DeepSeek-V2 to execute for node A. After it returns the summary result, the meta-template engine uses this summary result as input, adapts it to the "Chinese translation" template of Tongyi Qianwen-Max selected for node B, calls the API again, and finally returns the translation result.
[0046] If a user inputs "Analyze the sentiment of this article and summarize the key points", it is broken down into node C (sentiment analysis) and node D (summarize key points). Since node C and node D have no dependency relationship, they are parallel. Therefore, node C and node D are executed in parallel, and the average response time is reduced by about 40% compared to the serial method.
[0047] Furthermore, it also includes performing Kahn topological sorting on the task-directed graph, including the following steps: Calculate the in-degree of each graph node.
[0048] All graph nodes with an in-degree of 0 are placed in a queue and executed one by one; nodes that enter the queue in the same batch are grouped into the same parallel group.
[0049] When the queue is not empty: take a node u from the queue and add it to the result sequence; traverse all neighbors v of u and decrement the in-degree of v by 1; if the in-degree of v becomes 0, add v to the queue; merge the output results of all queues and return them to the user as the final response.
[0050] If the number of nodes in the resulting sequence equals the total number of nodes in the graph, the sorting is successful; otherwise, a cycle exists in the graph, and if a directed cycle is detected, an exception is thrown and execution is refused.
[0051] Furthermore, the constructed task directed graph is serialized into JSON format and stored, containing a graph_id, nodes array, edges array, and execution_order array. The nodes array contains node_id, ability_id, and input_binding; the edges array contains from, to, and type; and the execution_order array is a list of parallel groups. This JSON object is stored in a database and cached in Redis (storage module), with a TTL (Time To Live) set to 1 hour, allowing large models to retrieve and assemble results during asynchronous callbacks when calling the gateway.
[0052] Specifically, an example of the storage format for a task-directed graph is as follows: Wherein, graph_id represents the unique identifier of the directed graph of the task; nodes represents the list of graph nodes; node_id represents the graph node number; ability_id represents the name of the atomic ability; text_summarization represents the text summary; params represents the call parameters; input_binding represents the data source; user_input represents user input; text_generation represents text generation; commentary represents comments; node_output represents non-user input; edges represents the graph node dependencies; from represents the starting point; to represents the ending point; type represents the type; sequential represents the order relationship (execution order); and execution_order represents an array that is a list of parallel groups (i.e., the execution order).
[0053] S2: Traverse each atomic capability of the task directed graph in the pre-built capability-model mapping database to determine the execution big model for each atomic capability.
[0054] In this embodiment, the pre-built capability-model mapping database records the performance metrics (accuracy, latency, cost, overall score, and constraints, etc.) and interface metadata of all registered large models (such as GPT-4o, Claude 3.5 Sonnet, DeepSeek-V2, Tongyi Qianwen-Max, Wenxin Yiyan 4.0, etc.) in various atomic capability dimensions; the performance metrics are obtained through pre-setting or pre-calculation.
[0055] For example, the format of a capability-model mapping database is: Here, `ability_id` represents the name of the atomic capability, such as text summarization; `model_id` represents the name of the large model. Multiple models can correspond to the same capability, and the same model can serve multiple capabilities; `accuracy` represents the accuracy, i.e., the accuracy of the large model on the atomic capability, typically between 0 and 1, such as 0.92; `latency_ms` represents latency, an integer type, usually in milliseconds, representing the average response time for calling the large model to complete the atomic capability, such as 1200 representing 1.2 seconds, used to evaluate speed, with lower latency generally being better; `cost` represents the cost, i.e., the economic cost of calling the large model to complete the atomic capability, such as the cost per call or the cost per thousand tokens; `score` represents the overall score, usually calculated based on metrics such as accuracy, latency_ms, and cost, with `score = 0.6 × accuracy - 0.4 × (normalized latency cost)`, used for ranking and automatically selecting the optimal model, with higher scores for models with higher accuracy, lower latency, and lower cost; `PRIMARYKEY` represents a constraint, composed of the `ability_id` and `model_id` fields, ensuring that the same large model can only appear once under the same atomic capability.
[0056] In this embodiment, each atomic capability of the task directed graph is traversed in the pre-built capability-model mapping database to query large models that meet the minimum performance threshold of the atomic capability and are currently available, which are then used as candidate large models; generally, no less than one candidate large model is obtained from the query.
[0057] Specifically, the traversal method is as follows: Here, SELECT model_id FROM model_mapping means querying and returning model_id (the name of the large model) from model_mapping (capability-model mapping database); ability_id = ? means querying records with a specified atomic capability; accuracy >= min_acc means retaining large models with an accuracy greater than or equal to the minimum accuracy; ORDER BY score DESC means sorting the records that meet the conditions by score from high to low; LIMIT 1 means only taking the first record after sorting, that is, selecting the model with the highest overall score. If no model meets the conditions, the query result is empty.
[0058] Specifically, such as Figure 3 As shown, S2 includes the following steps: S2-1: Traverse each atomic capability of the task directed graph in the pre-built capability-model mapping database to obtain the performance metrics of each large model (such as GPT-4o, Claude 3.5 Sonnet, DeepSeek-V2, Tongyi Qianwen-Max, Wenxin Yiyan 4.0, etc.) on each atomic capability dimension, including accuracy, latency, cost, overall score and constraints.
[0059] S2-2: Eliminate large models with an accuracy less than the minimum accuracy, and retain only large models with an accuracy greater than or equal to the minimum accuracy as candidate large models for atomic capability.
[0060] S2-3: Sort the candidate large models in descending order of their comprehensive scores, and select the first candidate large model (with the highest comprehensive score) as the execution model.
[0061] For example, the atomic capability is text summarization. The text summarization is traversed in a pre-built capability-model mapping database to obtain candidate large models such as Claude 3.5 Sonnet, DeepSeek-V2, and Tongyi Qianwen-Max. After sorting according to the comprehensive score, DeepSeek-V2 is selected as the execution large model for text summarization.
[0062] The atomic capability is sentiment analysis. Sentiment analysis is traversed in a pre-built capability-model mapping database to obtain candidate large models GPT-4o and Wenxin Yiyan 4.0. After sorting according to the comprehensive score, Wenxin Yiyan 4.0 is selected as the execution large model for sentiment analysis.
[0063] Furthermore, the matching of large models can also be achieved using a dual-tower matching network. The dual-tower matching network concatenates the atomic capability ID embedding with the BERT encoding of the capability description text, and then maps it to a capability vector through a fully connected layer; then it maps the performance index vectors of the large model on each dimension benchmark to a model vector through an MLP; the cosine similarity between the capability vector and the model vector is calculated as the matching score, and the large model with the highest matching score is selected as the large model to execute the corresponding atomic capability.
[0064] This dual-tower matching network uses the best-performing (capability, model) pair from historical calls as positive examples and other models with the same capability as negative examples. It employs InfoNCE loss for comparative learning training with a temperature coefficient τ=0.07. After training, when a new model is registered, only its model vector needs to be calculated to obtain the matching score in real time, so that the matching results can be automatically adjusted according to changes in model performance.
[0065] S3: Employs a meta-template engine to dynamically populate the task semantics and contextual information of atomic capabilities into the meta-template placeholders of the execution model, automatically generating API request payloads that are fully adapted to the execution model.
[0066] In this embodiment, the meta-template engine primarily functions as a replacement mechanism. Internally, this engine stores parameterized syntax fragments (meta-templates) for different large model interface description paradigms. When a candidate model (such as DeepSeek-V2) is selected to execute an atomic capability (such as text summarization), the engine dynamically fills the task semantics (such as the text to be summarized) and contextual information carried by the atomic capability unit into the corresponding meta-template placeholder for the executing large model, automatically generating an API request payload fully adapted to that model. This achieves a fully automatic conversion from "task semantics" to "model-specific instructions."
[0067] Specifically, such as Figure 4 As shown, S3 includes the following steps: S3-1: Determine parameter values based on the current system load (current concurrency / maximum concurrency). If the load is below 30%, take the upper limit of the suggested range for parameters (high quality, such as temperature=0.3, max_tokens=1024); if the load is above 70%, take the lower limit for parameters (low latency, such as temperature=0.1, max_tokens=512).
[0068] Furthermore, parameter values can be predicted using a lightweight parameter adaptation network. This network takes a capability ID embedding vector (32-dimensional), a task text statistical feature vector (16-dimensional), and the current load features of the candidate model (1-dimensional) as input. After two fully connected layers (64→32) and ReLU activation, it outputs continuous values for temperature and max_tokens; temperature is mapped to 0.1–1.0 using a sigmoid function, and max_tokens is linearly mapped to 128–4096. The network uses the top 10% of parameter configurations in the historical call logs as supervision labels, employs mean squared error as the loss function, and is trained using the Adam optimizer with a learning rate of 1e-3, a batch size of 256, and 50 epochs. This network is completely decoupled from the large backend model, allowing for incremental training and continuous optimization of parameter predictions as the system runs.
[0069] S3-2: Dynamically populate the task semantics and context information of atomic capabilities into the meta-template placeholders of the execution model, and automatically generate API request payloads that are fully adapted to the execution model.
[0070] For example, DeepSeek-V2, as a large-scale model for text summarization, has the following meta-template representation: Wherein, model represents the name of the main model; system_prompt represents a system instruction placeholder; user_input represents a user input task requirement placeholder; temperature represents temperature; temp represents a temperature data placeholder; max_tokens represents the maximum computing power; max_tok represents the maximum computing power placeholder; stream indicates whether to return in streaming mode; false indicates that the complete result will be returned all at once after all models are generated.
[0071] In this embodiment, the system_prompt (system instruction) in the meta template placeholder can be replaced with the prompt field value (role prompt word) of the text summary, for example: You are a professional text summary assistant, please summarize the following key points in concise language; replace user_input in the meta template placeholder with the task requirements entered by the user; thereby generating an API request payload that is fully adapted to DeepSeek-V2.
[0072] S3-3: After the data is populated, call the JSON Schema validator to verify whether the generated API request payload conforms to the API specification of the execution model (this is existing technology and will not be elaborated here); if it does, the verification passes and the request is sent for execution; otherwise, the verification fails and the general default template of the execution model is used to retry once.
[0073] S4: Send the API request payload in parallel or serial to the execution model to obtain the execution results, assemble the returned execution results according to the task-oriented graph to obtain the final result, and output the final result to the user.
[0074] This embodiment also includes a model hot-plug mechanism: When a new large model needs to be integrated (such as a newly released domestic model), the administrator only needs to upload a standard capability description file and a set of corresponding meta-template fragments through the model registry center. The system automatically completes the verification and writes it into the capability-model mapping database, and the model becomes globally available immediately. The entire process does not require restarting the service or writing code, achieving true zero-code, hot-swappable integration.
[0075] B1: When receiving a large model to be updated, first parse the large model to be updated to verify its integrity.
[0076] For example, the system retrieves information such as the identifier, name, provider, calling address, capability array, and template array of the large model to be updated. If any field is missing, of incorrect type, or in the wrong format, an error, such as a 400 Bad Request, is returned. This is to prevent dirty data from entering the database.
[0077] B2: Check if the name of the large model to be updated already exists in the capability-model mapping database; if not, insert the large model to be updated into the capability-model mapping database to form the updated large model; if so, update the existing large model according to the parameters of the large model to be updated to form the updated large model. Ensure that there is only one master record for each large model in the capability-model mapping database.
[0078] B3: Then, the updated large model is mapped to the supported atomic capabilities and prompt words, that is, the atomic capabilities and meta templates supported by the updated large model are obtained and uploaded to the pre-built capability-model mapping database.
[0079] In this embodiment, the model configuration is not hardcoded into the code, and the model list is not loaded only once when the service starts. Instead, the model configuration is read from the database or cache with each request, the cache is actively refreshed, events are published, and the new configuration is used immediately after the database write is successful, without needing to restart the service.
[0080] Specifically, after Baidu released the new version of the "Wenxin Yiyan 4.0 Turbo" model and obtained its API documentation, a JSON-formatted capability description file was written according to the specifications, declaring the list of atomic capabilities supported by the model (such as support for "text summarization," "sentiment analysis," etc., with excellent performance metrics). Simultaneously, based on its new API syntax, 5-8 meta-template fragments (such as system prompt words and parameter combination templates) were written. These two types of files were uploaded through the model registry center. The system automatically validated the format and updated the database. Afterward, "Wenxin Yiyan 4.0 Turbo" was included as a candidate in the atomic capability matching process of all user requests. In one test case, the entire process of integrating this new model took approximately 2 minutes, while the traditional method of writing adaptation code would take approximately 4 hours.
[0081] like Figure 5 As shown, based on the above-mentioned model invocation method based on atomic capability abstraction and dynamic adaptation, the present invention also provides a model invocation system based on atomic capability abstraction and dynamic adaptation, specifically including a data acquisition module 10, a task abstraction module 20, a model matching module 30, a meta-template engine 40, and an output module 50; the output end of the data acquisition module 10 is connected to the input end of the task abstraction module 20, the output end of the task abstraction module 20 is connected to the input end of the model matching module 30, the output end of the model matching module 30 is connected to the input end of the meta-template engine 40, the output end of the meta-template engine 40 is connected to the input end of the output module 50, and the output end of the output module 50 is connected to the input end of the display module.
[0082] Among them, the data acquisition module 10 is used to acquire the task requirements input by the user; Task abstraction module 20, with a built-in intent understanding model (based on the existing base model), is used to abstract task requirements into at least one standardized atomic capability (such as text summarization, sentiment analysis, and Chinese translation). Model matching module 30 is used to traverse a pre-built capability-model mapping database based on standardized atomic capabilities to determine the execution big model for each atomic capability; Meta Template Engine 40 is used to dynamically populate the task semantics and context information of atomic capabilities into the meta template placeholders of the execution model, and automatically generate API request payloads that are fully adapted to the execution model. Output module 50 is used to call and execute the large model and generate the execution results, which are then returned to the user through the display module.
[0083] Those skilled in the art will understand that the above embodiments are specific examples of implementing the present invention. In practical applications of persistent media (such as server disks, NAS, and object storage), various changes in form and detail can be made without departing from the spirit and scope of the present invention.
Claims
1. A model invocation method based on atomic capability abstraction and dynamic adaptation, characterized in that, Specifically, the following steps are included: S1: Receive the task requirements uploaded by the user and abstract them into M standardized atomic capabilities to construct a directed task graph; M is a positive integer not less than 1; S2: Traverse each atomic capability of the task directed graph in the pre-built capability-model mapping database to determine the execution big model for each atomic capability; S3: Employs a meta-template engine to dynamically populate the task semantics and contextual information of atomic capabilities into the meta-template placeholders of the large execution model, and automatically generates API request payloads. S4: Send the API request payload in parallel or serial to the execution model to obtain the execution result, and output the execution result to the user.
2. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 1, characterized in that, In S1, the standardized atomic capabilities are defined using capability description primitives. Each capability description primitive includes a capability identifier, input / output mode, applicable model identifier, and minimum accuracy.
3. A model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 1 or 2, characterized in that, The method for constructing the directed graph of the task is as follows: A: Create a graph node for each atomic capability and assign it an auto-incrementing node number; B: Construct a directed graph of tasks based on the dependencies between the graph nodes: If two graph nodes have a sequential execution relationship, add a directed edge between the two graph nodes and set the input relationship of the later node to that of the earlier node; If two graph nodes are executed in parallel, then the input relationships of both graph nodes will be bound to the task requirements.
4. A model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 1 or 2, characterized in that, S2 includes the following steps: S2-1: Traverse each atomic capability of the task directed graph in the pre-built capability-model mapping database to obtain the performance indicators of each large model in each atomic capability dimension; S2-2: Eliminate large models with an accuracy less than the minimum accuracy, and only retain large models with an accuracy greater than or equal to the minimum accuracy as candidate large models for atomic capability. S2-3: Select the candidate model with the highest comprehensive score as the execution model.
5. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 4, characterized in that, In S2-1, the pre-built capability-model mapping database records the performance metrics and interface metadata of all registered large models in each atomic capability dimension; the performance metrics include accuracy, latency, cost, overall score, and constraints.
6. A model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 1 or 2, characterized in that, S3 includes the following steps: S3-1: Determine parameter values based on the current system load; parameters include temperature and maximum computing power; S3-2: Dynamically populate the task semantics and context information of atomic capabilities into the meta-template placeholders of the large execution model to automatically generate API request payloads; S3-3: After the data is populated, call the JSON Schema validator to verify whether the generated API request payload conforms to the API specification for executing large models; if yes, the verification passes and is sent for execution; otherwise, the verification fails.
7. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 6, characterized in that, In S3-1, if the load is below 30%, the parameter value is taken as the upper limit of the suggested range; if the load is above 70%, the parameter value is taken as the lower limit.
8. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 1, characterized in that, It also includes a hot-plug mechanism for models to be updated, which specifically includes the following steps: B1: Parse the parameters of the large model to be updated and verify the integrity of the large model; the parameters of the large model to be updated include the identifier, large model name, provider, calling address, capability array and template array; B2: Check if the model name of the large model to be updated already exists in the capability-model mapping database; if not, insert the large model to be updated into the capability-model mapping database to form the updated large model; if so, update the existing large model according to the parameters of the large model to be updated to form the updated large model. B3: Obtain the updated atomic capabilities and meta-templates supported by the large model and upload them to the pre-built capability-model mapping database.
9. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 8, characterized in that, The parameters of the large model to be updated include the identifier, large model name, provider, calling address, capability array, and template array.
10. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 1, characterized in that, In S1, an intent understanding model is used to abstract task requirements into M standardized atomic capabilities. This intent understanding model builds a three-head parallel prediction architecture on top of the BERT-base-chinese encoder, including a capability sequence generation head, a dependency relationship head, and a parameter slot filling head. The total loss function L is: L = L_seq + 0.5·L_dep + 0.3·L_slot Where L_seq is the sequence cross-entropy loss, L_dep is the dependency classification cross-entropy loss, and L_slot is the CRF negative log-likelihood loss.
11. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 6, characterized in that, In S3-1, the parameter values are predicted by a lightweight parameter adaptation network. The input of this lightweight parameter adaptation network is the capability ID embedding vector, the task original text statistical feature vector, and the current load features of the candidate model. The output is temperature and maximum computing power after passing through two fully connected layers. The network is trained using the top 10% of the parameters in the historical call logs in terms of quality scores as supervision labels and mean squared error as the loss function.
12. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 1, characterized in that, In S2, a dual-tower matching network can also be used to perform matching of large models: First, the atomic capability ID is embedded and concatenated with the BERT encoding of the capability description text, and then mapped into a capability vector through a fully connected layer; Then, the performance metric vectors of the large model on each dimension benchmark are mapped to model vectors using MLP; Finally, the cosine similarity between the capability vector and the model vector is calculated and used as the matching score. The large model with the highest matching score is selected as the execution large model for the corresponding atomic capability.
13. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 3, characterized in that, The task's directed graph is serialized and stored in JSON format, containing a graph_id, nodes array, edges array, and execution_order array; the nodes array contains node_id, ability_id, and input_binding, the edges array contains from, to, and type, and the execution_order array is a list of parallel groups; the JSON object is stored in a database and cached in Redis.
14. The model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 10, characterized in that, Before calling the intent understanding model, the user's task requirements are first matched with the pre-built high-frequency composite intent template library for similarity. If the similarity exceeds 0.95, the atomic capability sequence and dependencies corresponding to the template are directly adopted, skipping the intent understanding model parsing step.
15. A model invocation method based on atomic capability abstraction and dynamic adaptation according to claim 1, 2, or 10, characterized in that, The standardized atomic capabilities are pre-defined into four categories: understanding, generation, processing, and advanced. The understanding category includes text summarization, sentiment analysis, entity extraction, intent classification, and keyword extraction. The generation category includes text continuation, text rewriting, multilingual translation, and code generation. The processing category includes format conversion, data extraction, and text proofreading. The advanced category includes thought chain reasoning, tool invocation, and multi-document integrated question answering.
16. A model invocation system based on atomic capability abstraction and dynamic adaptation, characterized in that, The method described in any one of claims 1-15 includes: The data acquisition module is used to acquire the task requirements input by the user; The task abstraction module is used to abstract task requirements into at least one standardized atomic capability; The model matching module is used to traverse a pre-built capability-model mapping database based on standardized atomic capabilities to determine the execution big model for each atomic capability. The meta-template engine is used to dynamically populate the task semantics and contextual information of atomic capabilities into meta-template placeholders for executing large models, and automatically generate API request payloads. The output module is used to call and execute the large model, generate the execution results, and return them to the user.
