Model selection method and device based on semantic matching, equipment and medium
Patent Information
- Application Number
- CN202611005866.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-10-09
AI Technical Summary
这种方案在模型种类较少、业务场景相对固定的情况下尚可维持运行,但随着接入的模型数量增加以及业务应用对生成质量要求的提升,现有的方案存在一些不足,例如:基于规则或标签的配置方式严重依赖于运维人员对各模型能力的主观判断,而模型的实际能力往往难以通过简单的标签准确描述,导致配置结果与实际表现之间存在偏差
通过将请求的提示词内容和各模型的能力描述文本分别映射为同一向量空间中的语义指纹,使得请求语义与各模型能力之间的匹配程度能够被量化计算,实现了根据每次请求的实际语义内容动态评估各候选模型并进行选择,避免了传统方案中依赖人工配置标签所导致的主观判断偏差和配置更新滞后。通过各模型的实时效能评分对语义关联度进行加权修正,使得当前运行状态良好的模型在排序中获得优势,保证了最终选择的模型同时具备能力匹配和可用性保障。通过在正式执行推理之前按排序结果对各模型进行探测验证,消除了评估数据与实际接口状态之间可能存在的偏差,确保被选中的模型能够正常完成推理任务,从而实现了评估各候选模型与当前请求之间的匹配程度,以确定最合适的模型进行推理的技术效果。
Smart Images

Figure CN122886607A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for model selection based on semantic matching. Background Technology
[0002] Currently, the demand for AI content generation capabilities from various business applications is increasing daily. Multiple AI model vendors offer model services with varying functionalities, and a platform typically needs to integrate multiple AI models from different vendors to meet diverse business scenarios. In existing model invocation solutions, platforms usually use manually configured rules or tag matching for model selection. When a business application requests a model, the platform searches for a matching model in its configuration table based on the business type identifier or function node identifier carried in the request. This solution can maintain operation when the number of models is small and the business scenarios are relatively fixed. However, as the number of integrated models increases and business applications demand higher quality output, the existing solution has some shortcomings. For example, rule-based or tag-based configuration heavily relies on the subjective judgment of operations personnel regarding the capabilities of each model, while the actual capabilities of a model are often difficult to accurately describe through simple tags, leading to discrepancies between the configuration results and actual performance. Secondly, the existing configuration method is static. When model vendors update model versions or the actual performance of models changes over time, the pre-configured rules cannot automatically adapt to these changes, requiring operations personnel to re-evaluate and adjust the configuration, resulting in high maintenance costs.
[0003] Therefore, existing technologies have the technical problem of being unable to dynamically evaluate the degree of matching between each candidate model and the current request in order to achieve accurate model selection. Summary of the Invention
[0004] In view of the above, this application provides a model selection method, apparatus, device and storage medium based on semantic matching, the purpose of which is to solve the above technical problems.
[0005] Firstly, this application provides a model selection method based on semantic matching, the method comprising: Intercept AI call requests initiated by business applications, map the prompts of AI call requests to semantic vectors, and obtain the request semantic fingerprint corresponding to the AI call request; Map the capability description text of each candidate AI model to a semantic vector and store it to obtain the static capability fingerprint corresponding to each candidate AI model in the global capability fingerprint database. Calculate the semantic correlation degree between the request semantic fingerprint and each of the static capability fingerprints, sort all candidate AI models according to each of the semantic correlation degrees, and obtain the initial ranking sequence of candidate models corresponding to the AI call request; Obtain the real-time performance score of each candidate AI model, and re-sort the semantic relevance based on the real-time performance score to obtain the preferred model execution chain corresponding to the AI call request; Probe requests are sent to each candidate AI model in the order of the preferred model execution chain. The first candidate AI model that passes the probe is determined as the target execution model, and the target execution model is invoked to perform inference operations.
[0006] Secondly, this application provides a semantic matching-based model selection device, which includes: The first mapping module is used to intercept AI call requests initiated by business applications, map the prompts of AI call requests into semantic vectors, and obtain the request semantic fingerprint corresponding to the AI call request. The second mapping module is used to map the capability description text of each candidate AI model into a semantic vector and store it, so as to obtain the static capability fingerprints corresponding to each candidate AI model in the global capability fingerprint database. Calculation module: used to calculate the semantic correlation between the request semantic fingerprint and each of the static capability fingerprints, sort all candidate AI models according to each of the semantic correlations, and obtain the initial ranking sequence of candidate models corresponding to the AI call request; The sorting module is used to obtain the real-time performance scores of each candidate AI model, and then re-sort them by weighting the semantic relevance of each real-time performance score to obtain the preferred model execution chain corresponding to the AI call request. Selection module: Used to send probe requests to each candidate AI model in the order of the preferred model execution chain, determine the first candidate AI model that passes the probe as the target execution model, and call the target execution model to perform inference operations.
[0007] Thirdly, this application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the steps of the semantic matching-based model selection method described in any embodiment of the first aspect.
[0008] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the semantic matching-based model selection method as described in any embodiment of the first aspect.
[0009] The technical solutions provided in this application have the following advantages compared with the prior art: By mapping the request prompts and the capability descriptions of each model to semantic fingerprints in the same vector space, the matching degree between the request semantics and the capabilities of each model can be quantified. This enables dynamic evaluation and selection of candidate models based on the actual semantic content of each request, avoiding subjective judgment bias and configuration update lag caused by manual label configuration in traditional solutions. The semantic relevance is weighted and corrected using real-time performance scores for each model, giving models with good current performance an advantage in the ranking, ensuring that the final selected model has both capability matching and availability guarantees. By probing and verifying each model according to the ranking results before formal inference execution, potential discrepancies between evaluation data and actual interface status are eliminated, ensuring that the selected model can complete the inference task normally. This achieves the technical effect of evaluating the matching degree between each candidate model and the current request to determine the most suitable model for inference. Attached Figure Description
[0010] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0011] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart illustrating a preferred embodiment of the semantic matching-based model selection method of this application; Figure 2 This is a schematic diagram of a preferred embodiment of the semantic matching-based model selection device of this application; Figure 3 This is a schematic diagram of a preferred embodiment of the electronic device of this application; The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0013] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0014] It should be noted that the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of those features. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.
[0015] Reference Figure 1 The diagram shown is a flowchart illustrating an embodiment of the semantic matching-based model selection method of this application. The method is executed by an electronic device, which can be implemented by a software system and / or a hardware system. The semantic matching-based model selection method includes: Step S10: Intercept the AI call request initiated by the business application, map the prompt word content of the AI call request into a semantic vector, and obtain the request semantic fingerprint corresponding to the AI call request; Step S20: Map the capability description text of each candidate AI model to a semantic vector and store it to obtain the static capability fingerprint corresponding to each candidate AI model in the global capability fingerprint database; Step S30: Calculate the semantic correlation degree between the request semantic fingerprint and each of the static capability fingerprints, and sort all candidate AI models according to each of the semantic correlation degrees to obtain the initial ranking sequence of candidate models corresponding to the AI call request; Step S40: Obtain the real-time performance score of each candidate AI model, and re-sort the semantic relevance based on the real-time performance score to obtain the preferred model execution chain corresponding to the AI call request; Step S50: Send probe requests to each candidate AI model in the order of the preferred model execution chain, determine the first candidate AI model that passes the probe as the target execution model, and call the target execution model to perform inference operations.
[0016] In the process of various business applications calling AI models to generate content, each AI call request initiated by a business application contains prompt words, which reflect the specific task that the business application expects the AI model to complete. However, due to differences in training data, model architecture, and optimization goals, different AI models are better at handling different types of prompt words. If the prompt words are directly handed over to a model that is not good at processing them, the generation quality will be poor. Therefore, this embodiment first extracts semantic features from the prompt words of the AI call request. Specifically, the AI call request initiated by the business application is intercepted, the prompt words carried in the request are read, and then the prompt words are input into a semantic encoder. This semantic encoder uses a pre-trained language model that can convert natural language text of arbitrary length into a fixed-dimensional semantic vector. After encoding the prompt words, the semantic encoder outputs a semantic vector, which is the request semantic fingerprint corresponding to the AI call request. The request semantic fingerprint represents the position of the request in the semantic space in the form of a numerical vector, and all subsequent matching calculations related to the request are based on the request semantic fingerprint.
[0017] To enable the request semantic fingerprint to support subsequent multi-dimensional matching calculations, the request semantic fingerprint can be internally organized into multiple vector segments according to preset dimensional division rules. Each vector segment carries feature information corresponding to different semantic levels in the request, so as to perform fine-grained segmented comparison with the model capability fingerprint in the future.
[0018] After extracting the semantic features of the current request, the capability features of each candidate AI model need to be converted into vector representations in the same semantic space to facilitate subsequent calculations of the matching degree between the request and the model. Specifically, the capability description text of each candidate AI model is obtained in advance. This capability description text is extracted from publicly available technical documents provided by the model vendor or metadata entered during model registration. Its content describes the types of tasks the model excels at, its capability advantages, and applicable business scenarios. Subsequently, the capability description text of each candidate AI model is input into the same semantic encoder as in step one. This semantic encoder maps each capability description text into a corresponding semantic vector, which is the static capability fingerprint of the candidate AI model. The static capability fingerprint represents the capability positioning of the model in the semantic space in the form of a numerical vector. Since the above operations use the same semantic encoder, the request semantic fingerprint and each static capability fingerprint are in the same vector space, thus making them comparable.
[0019] To match the internal organization of the request semantic fingerprint, each static capability fingerprint is also internally organized into multiple vector segments according to the same dimensional division rules. This allows for segment-by-segment comparison between the request semantic fingerprint and the static capability fingerprint based on the correspondence between the vector segments. The static capability fingerprints of each candidate AI model are stored in a global capability fingerprint database, which uses the model identifier as an index and stores the static capability fingerprints of each candidate AI model.
[0020] After obtaining the request semantic fingerprint and each static capability fingerprint, it is necessary to quantitatively evaluate the semantic matching degree between the current request and each candidate AI model. Specifically, the request semantic fingerprint is read from the context of the current request, and the static capability fingerprints of each candidate AI model are sequentially read from the global capability fingerprint database. For each candidate AI model, the correlation between its static capability fingerprint and the request semantic fingerprint is calculated. For example, according to the correspondence of vector segments, each vector segment in the request semantic fingerprint is paired with each vector segment in the static capability fingerprint, so that the request feature vectors belonging to the same semantic level and the model capability feature vectors form a one-to-one pairing relationship.
[0021] The vector distance between each pair of paired vector segments is calculated. This vector distance reflects the degree of difference between the request and the model at that semantic level and in that capability dimension. The smaller the vector distance, the higher the matching degree between the two in that dimension. After obtaining the vector distances in each dimension, the vector distances can be aggregated into a comprehensive value according to a preset fusion rule. This comprehensive value is the semantic correlation degree between the request semantic fingerprint and the static capability fingerprint. The fusion rule can be implemented in various mathematical forms, such as weighted sum, weighted average, or other combinations of operations on the vector distances. The semantic correlation degree comprehensively reflects the overall fit between the current request and the corresponding candidate AI model at all semantic levels. The higher the semantic correlation degree, the better the capability features of the model match the task requirements of the current request. The semantic correlation degree between the current request and all candidate AI models is calculated one by one in the above manner. All candidate AI models are then sorted from high to low according to the value of each semantic correlation degree, resulting in a model sequence arranged in descending order of semantic matching degree. This sequence is the initial ranking sequence of candidate models.
[0022] Semantic matching only reflects the fit between the model's capabilities and the requested task, but it fails to reflect the actual operating status of each candidate AI model at the current moment. A model with a high semantic match, if experiencing service congestion, slow response, or frequent errors, will result in a poor user experience when invoked. To balance semantic matching and real-time performance, an evaluation of the model's current operating status needs to be introduced on top of semantic ranking. Specifically, the operating metrics of each candidate AI model within the most recent time window are read. These metrics must contain at least quantitative parameters that reflect the model's current service capabilities. For each candidate AI model, a real-time performance score is calculated based on its operating metrics. This score integrates information from multiple operating metrics; a higher score indicates a stronger service capability of the model at the current moment.
[0023] To ensure that the score has an appropriate impact on subsequent rankings, the real-time performance score can be adjusted for timeliness. This involves adjusting the score value based on the age of the operational metrics upon which the score relies, thus reasonably reducing the reference value of outdated scores. After this processing, the real-time performance score of each candidate AI model is used as a weighting factor to weight the semantic relevance of each model in the initial ranking sequence. This involves multiplying the semantic relevance of each model by its corresponding real-time performance score to obtain a comprehensive score for each model. Through this weighting operation, models with high semantic matching and good current operational status will receive higher comprehensive scores, while models with high semantic matching but poor current operational status will have their comprehensive scores appropriately lowered.
[0024] The ranking of the preferred model execution chain represents the system's overall evaluation of the performance of each candidate AI model. However, this evaluation is calculated based on historical running data and may still be inconsistent with the actual interface status. To confirm that the target model's interface is indeed usable before actual invocation and to avoid request failures due to direct invocation of faulty models caused by discrepancies between the evaluation results and the actual status, it is necessary to quickly verify each model before formal inference execution.
[0025] Specifically, the order of candidate AI models is extracted from the preferred model execution chain. Then, probe requests are sent to each candidate AI model sequentially according to this order. These probe requests are used to verify the interface connectivity and basic responsiveness of the target model. Their content construction differs from that of a complete inference request; the amount of data carried by a probe request is less than that of a complete inference request, resulting in a significantly shorter probe process time compared to the complete inference process. After sending the probe requests, the system waits for each candidate AI model to return a probe response and compares the returned response with preset pass criteria. These preset pass criteria are quantitative standards for determining whether the model interface is usable, such as whether the response status meets expectations and whether the response time is within acceptable limits.
[0026] If the probe response of the current candidate AI model meets all the pass conditions, the model is deemed to have passed the probe, and the system immediately designates this model as the target execution model and terminates the probe of subsequent candidate AI models. If the probe response of the current candidate AI model does not meet the pass conditions, the model is deemed to have failed the probe, and the system continues to send probe requests to the next candidate AI model in the preferred model execution chain until a model that has passed the probe is found. Once the target execution model is determined, the system extracts the complete prompt word content from the original AI call request and uses this complete prompt word content to initiate a complete inference request to the target execution model. After receiving the complete inference request, the target execution model performs the complete inference operation, generates the inference result, and returns it. The system then returns the inference result to the business application that initially initiated the call request, completing this AI call.
[0027] By mapping the prompts of AI call requests to request semantic fingerprints and the capability descriptions of candidate AI models to static capability fingerprints, and calculating the semantic correlation between the two in the same semantic space, model selection no longer relies on manually configured rules or labels. Instead, it is based on the essential semantic matching relationship between the request content and the model's capabilities, avoiding scheduling tasks to models with mismatched capabilities. This embodiment introduces real-time performance scoring for weighted correction based on semantic correlation ranking, allowing semantic matching and real-time running status to participate in scheduling decisions simultaneously. Under the premise of model capability fit, models with good current running status are prioritized. This avoids both slow response caused by calling congested models in pursuit of high semantic matching and low generation quality caused by calling mismatched models in pursuit of low cost or high performance metrics.
[0028] Before performing full inference, each model is probed and verified in the order of the preferred model execution chain. The actual availability of each model interface is quickly confirmed through lightweight probe requests, which effectively avoids call failures caused by inconsistencies between evaluation data and actual state. At the same time, the amount of data in the probe request is smaller than that in the full inference request, so the time spent in the probe phase is much less than that spent in the full inference phase. Even if multiple models in the probe sequence are probed in turn, the overall additional time is still within an acceptable range.
[0029] In one embodiment, after performing the inference operation to obtain the inference result, the method further includes: Based on the direction of the quality feedback signal of the inference result, the static capability fingerprint corresponding to the target execution model in the global capability fingerprint database is corrected by vector offset, and the corrected static capability fingerprint is updated back to the global capability fingerprint database.
[0030] After the target execution model returns the inference result, the corresponding quality feedback signal is obtained. This quality feedback signal can be obtained in various ways. For example, it can be an explicit feedback signal generated and returned to the system by the business application based on the user's satisfaction rating after receiving the inference result; or an implicit feedback signal generated by the system automatically scoring the inference result using a preset quality assessment model before returning the inference result to the business application. Regardless of the source, the quality feedback signal participates in subsequent correction operations in both positive and negative directions. A positive quality feedback signal indicates that the quality of the inference result meets or exceeds expectations, and the capability of the target execution model matches the requirements of the current request; a negative quality feedback signal indicates that the quality of the inference result does not meet expectations, and the capability of the target execution model does not match the requirements of the current request.
[0031] Upon receiving a quality feedback signal, the system determines a correction strategy for the static capability fingerprint based on the direction of the signal. If the feedback signal is positive, it indicates that the static capability fingerprint of the target execution model should be strengthened in the semantic direction corresponding to the current request. The system shifts the vector direction of the target execution model's static capability fingerprint towards the direction of the current request's semantic fingerprint, thus bringing the model's static capability fingerprint closer to the semantic region of the current request in the vector space. If the feedback signal is negative, it indicates that the static capability fingerprint of the target execution model should be weakened in the semantic direction corresponding to the current request. The system shifts the vector direction of the target execution model's static capability fingerprint away from the direction of the current request's semantic fingerprint, thus moving the model's static capability fingerprint away from the semantic region of the current request in the vector space.
[0032] After each inference operation is completed, the static capability fingerprint of the invoked model will undergo a slight shift in the vector space based on the actual effect of this invocation. Positive feedback pulls its capability fingerprint toward the correct semantic direction, while negative feedback pushes it away from the wrong semantic direction. Through the cumulative correction of multiple invocations, the static capability fingerprints of each model in the global capability fingerprint database will gradually approach the actual position of the model's true capability in the semantic space, thereby enabling more accurate matching results when requests are performed on the semantic correlation degree based on static capability fingerprints.
[0033] In one embodiment, mapping the prompt word content of the AI call request to a semantic vector to obtain the request semantic fingerprint corresponding to the AI call request includes: The text structure of the prompts in the AI call request is parsed to identify the instruction intent part, target object part, and constraint condition part in the prompts, and the prompts are then split into instruction intent text segments, target object text segments, and constraint condition text segments. Semantic encoding operations are performed on the instruction intent text segment, the target object text segment, and the constraint condition text segment respectively to generate an instruction intent vector corresponding to the instruction intent text segment, a target object vector corresponding to the target object text segment, and a constraint condition vector corresponding to the constraint condition text segment; The instruction intent vector, the target object vector, and the constraint vector are weighted and concatenated according to predetermined weights to generate the request semantic fingerprint corresponding to the AI call request.
[0034] Natural language prompts typically mix various types of semantic information, such as what operation the user wants the model to perform, what object the user wants the model to perform the operation on, and what restrictions the user has imposed on the operation result. If all of the above information is encoded as a whole, the different types of information will be mixed together in the semantic vector, which may cause the encoding result to fail to accurately reflect the differentiated features of the prompt in different semantic dimensions, thus affecting the accuracy of subsequent matching with the model's capability fingerprint.
[0035] This embodiment performs text structure parsing on the prompts for AI requests. This operation employs text classification or sequence labeling techniques from natural language processing to identify the semantic role of each word or phrase in the prompt content, thereby recognizing the instruction intent, target object, and constraint conditions within the prompt content. The instruction intent refers to the content in the prompt that instructs the model to perform an operation, such as requiring the model to generate text, translate a sentence, summarize a document, or answer a question. The target object refers to the content in the prompt that carries the object of the operation, such as requiring the model to translate the original text of a sentence, requiring the model to summarize the full text of a document, or requiring the model to solve a math problem. The constraint conditions refer to the restrictions imposed on the operation result, such as specifying the output format, the output length range, the language used, or the style requirements. After recognition, the system splits the prompt content into three independent text segments according to the boundaries of these three parts: the instruction intent text segment, the target object text segment, and the constraint condition text segment.
[0036] After obtaining the three vectors mentioned above, they need to be combined into a unified request semantic fingerprint so that they can participate in the matching calculation as a whole in the subsequent process. Specifically, the pre-determined weight configuration information is read, which specifies the corresponding weight values for the instruction intent vector, target object vector, and constraint condition vector. This weight configuration information can be pre-set according to the business scenario during system deployment. For example, for question-and-answer function nodes, the weight of the instruction intent part can be set higher to emphasize the recognition of the user's operation intention; for content generation function nodes, the weight of the constraint condition part can be set higher to ensure that the generated results meet the format requirements. Different function nodes or different business applications can configure different combinations of weight values according to their own business characteristics, thereby flexibly adjusting the importance of each semantic layer in the subsequent semantic relevance calculation.
[0037] The three vectors are weighted and concatenated according to the weight configuration information. First, the instruction intent vector is multiplied by its corresponding weight value; then, the target object vector is multiplied by its corresponding weight value; and finally, the constraint vector is multiplied by its corresponding weight value. The three weighted vectors are then concatenated end-to-end according to a preset vector dimension order to form a complete vector, which is the request semantic fingerprint corresponding to the AI call request. The request semantic fingerprint generated through the weighted concatenation operation still retains the boundary information of each vector component and the corresponding weight information. This allows for the reconstruction of the vector information and weight information of each semantic level from the request semantic fingerprint during subsequent calculations of semantic relevance, thus supporting segmented comparison with the static capability fingerprint.
[0038] In one embodiment, mapping the capability description text of each candidate AI model to a semantic vector and storing it to obtain static capability fingerprints corresponding to each candidate AI model in the global capability fingerprint database includes: Obtain the capability description text of each candidate AI model, and then split the capability description text into task domain text segment, capability advantage text segment, and applicable limitation text segment; Semantic encoding operations are performed on the task domain text segment, capability advantage text segment, and applicable restriction text segment corresponding to each candidate AI model to generate task domain vector, capability advantage vector, and applicable restriction vector corresponding to each candidate AI model. The task domain vector, capability advantage vector, and applicable restriction vector corresponding to each candidate AI model are concatenated in a preset order to generate a static capability fingerprint corresponding to each candidate AI model. Each static capability fingerprint is then stored in the global capability fingerprint database at the storage location corresponding to each candidate AI model.
[0039] The process involves obtaining the capability description text for each candidate AI model. This text, provided by the model vendor during registration or system integration, describes the model's functional characteristics and technical capabilities in natural language. Each capability description text is then parsed to identify three parts: task domain description, capability advantage description, and applicability limitation description. These parts are then divided into three independent text segments. The task domain description describes the types of tasks or business scenarios the model is suitable for, such as mathematical problem solving, text summarization, or coding. The capability advantage description describes the model's advantages over other models, such as superior inference speed or outstanding generation quality in a specific domain. The applicability limitation description describes the conditions under which the model is not recommended or its limitations, such as lack of support for multilingual translation or input length restrictions.
[0040] For example, the capability description text of a candidate AI model is "This model is designed specifically for mathematical problem solving and logical reasoning tasks, and performs excellently in multi-step reasoning scenarios, but is not suitable for open-ended creative writing." After text structure analysis, the task domain description is identified as "designed specifically for mathematical problem solving and logical reasoning tasks," the capability advantage description is identified as "performs excellently in multi-step reasoning scenarios," and the applicability limitation description is identified as "not suitable for open-ended creative writing." After this splitting, independent semantic encoding operations are performed on the task domain text segment, capability advantage text segment, and applicability limitation text segment corresponding to each candidate AI model. That is, each text segment is input into a semantic encoder to generate its corresponding semantic vector, thereby obtaining the task domain vector, capability advantage vector, and applicability limitation vector corresponding to each candidate AI model.
[0041] After obtaining the three vectors, they need to be combined into a unified static capability fingerprint for storage in the global capability fingerprint database. Specifically, the task domain vector, capability advantage vector, and applicable restriction vector corresponding to each candidate AI model are concatenated in a preset order to form a complete vector, which is the static capability fingerprint of that candidate AI model. The preset order is consistent across all candidate AI models; for example, the task domain vector is concatenated first, the capability advantage vector is in the middle, and the applicable restriction vector is last. This ensures that the internal vector segmentation method of all static capability fingerprints in the global capability fingerprint database is completely consistent, facilitating subsequent unified segment comparison. After concatenation, the static capability fingerprint corresponding to each candidate AI model is stored in the global capability fingerprint database at the storage location corresponding to each candidate AI model, using the model identifier as an index.
[0042] The static capability fingerprint generated in the above manner is internally organized into multiple vector segments in a preset order, corresponding to the three dimensions of task domain, capability advantages, and applicable limitations. This segmented storage organization allows for segmented comparison of each vector component in the request semantic fingerprint with the corresponding vector segment in the static capability fingerprint during subsequent semantic correlation calculation. This enables fine-grained matching between the multi-dimensional semantic features of the request and the multi-dimensional capability features of the model. Compared to a single vector obtained by encoding the entire capability description text, segmented matching can more accurately identify the degree of matching between the request and the model in each semantic dimension, avoiding inaccurate matching results caused by strong signals in one dimension masking mismatches in other dimensions.
[0043] In one embodiment, calculating the semantic correlation between the request semantic fingerprint and each of the static capability fingerprints includes: Extract the instruction intent vector, target object vector, constraint vector, and weights corresponding to each vector from the request semantic fingerprint; Extract the first capability segment vector with the same dimension as the instruction intent vector, the second capability segment vector with the same dimension as the target object vector, and the third capability segment vector with the same dimension as the constraint condition vector from each static capability fingerprint. Calculate the vector distance between each group of vectors with the same dimension and generate the corresponding sub-item correlation degree based on each vector distance. The correlation of each item is weighted and summed according to the weights, and the weighted sum is used as the semantic correlation between the request semantic fingerprint and the static capability fingerprint.
[0044] Since the request semantic fingerprint is formed by multiplying the instruction intent vector, target object vector, and constraint vector by their respective weights and then concatenating them, it internally retains the boundary information of each vector component and the corresponding weight information. According to the preset vector dimension division rules, the instruction intent vector, target object vector, and constraint vector are extracted from the request semantic fingerprint, along with their corresponding instruction intent weights, target object weights, and constraint weights.
[0045] Since each static capability fingerprint is formed by concatenating the task domain vector, capability advantage vector, and applicable constraint vector in a preset order, and this preset order remains consistent across all static capability fingerprints, each vector segment can be extracted from each static capability fingerprint according to the same dimensional partitioning rules. Specifically, a first capability segment vector, a second capability segment vector, and a third capability segment vector are extracted from each static capability fingerprint. The first capability segment vector and the instruction intent vector are in the same vector space dimension; that is, the position interval of the first capability segment vector in the static capability fingerprint corresponds to the position interval of the instruction intent vector in the request semantic fingerprint. The second capability segment vector and the target object vector are in the same vector space dimension. The third capability segment vector and the constraint condition vector are in the same vector space dimension. Through the above extraction operations, a one-to-one semantic pairing relationship is established between the three vectors on the request side and the three vector segments on the model side. That is, the instruction intent vector and the first capability segment vector form the first pairing group, the target object vector and the second capability segment vector form the second pairing group, and the constraint condition vector and the third capability segment vector form the third pairing group.
[0046] After establishing pairing relationships, the vector distance between vectors of the same dimension in each group is calculated. Vector distance can be calculated using conventional vector distance metrics in this field, such as cosine distance or Euclidean distance. For the first pairing group, the vector distance between the instruction intent vector and the first capability segment vector is calculated to obtain the first vector distance. This distance reflects the degree of matching between the instruction intent of the current request and the model in the task domain dimension; the smaller the distance, the closer the task type the model excels at is to the operation type required by the current request. For the second pairing group, the vector distance between the target object vector and the second capability segment vector is calculated to obtain the second vector distance. This distance reflects the degree of matching between the target object of the current request and the model in the capability advantage dimension; the smaller the distance, the more suitable the model's capability advantage is for handling the content object involved in the current request. For the third pairing group, the vector distance between the constraint vector and the third capability segment vector is calculated to obtain the third vector distance. This distance reflects the degree of matching between the constraints of the current request and the model in the applicability restriction dimension; the smaller the distance, the more the model's applicability range can meet the various constraints proposed in the current request. After obtaining the three vector distances, each vector distance is converted into a corresponding sub-item correlation score, ensuring that the numerical range and direction of each sub-item correlation score are consistent; that is, the larger the value, the higher the matching degree of that dimension. The conversion can be achieved by taking the reciprocal of the vector distance.
[0047] After obtaining the three sub-item relevance scores, a weighted sum is performed on each sub-item relevance score using weights extracted beforehand from the request semantic fingerprint. Specifically, the instruction intent weight is multiplied by the first sub-item relevance score, the target object weight by the second sub-item relevance score, and the constraint weight by the third sub-item relevance score. These three products are then summed, and the resulting value is the semantic relevance score between the request semantic fingerprint and the static capability fingerprint. Through this weighted summation, different weight combinations allow the same request semantic fingerprint to produce different matching emphases when facing different requests. For example, when the constraint weight of a request is high, the sub-item relevance scores of the constraint dimension have a greater impact on the final semantic relevance score, thus enabling models with higher matching scores in the constraint dimension to obtain a higher overall semantic relevance score.
[0048] The semantic relevance between the current request and all candidate AI models is calculated one by one in the above manner, providing a quantitative basis for subsequent ranking. Compared with the method of directly calculating a single distance between two overall vectors, the above method of segment extraction, calculating the relevance of each segment, and then summarizing by weight can more accurately capture the matching differences between the request and the model in various semantic dimensions, avoiding the mismatch in other dimensions caused by strong signals in one dimension.
[0049] For example, when the constraints of the request are strict, even if a model is highly matched in the task domain dimension, if the applicability restrictions of the model conflict with the constraints of the request, the model's sub-item relevance in the third pairing group will be low. After the constraint weights are amplified, its overall semantic relevance will be significantly reduced, thus reflecting that the model is not suitable for this request in the ranking. Conversely, when the constraint weights of the request are low, the impact of the mismatch of the same model in the constraint dimension on the overall semantic relevance will be suppressed, allowing the model to still have a chance to obtain a high ranking due to its high match in the task domain dimension.
[0050] In one embodiment, obtaining the real-time performance scores of each candidate AI model, and then reordering them by weighting the semantic relevance of each real-time performance score to obtain the preferred model execution chain corresponding to the AI call request, includes: Read the average response time and call success rate of each candidate AI model within the most recent time window, and calculate the real-time performance score of each candidate AI model based on the average response time and the call success rate; Obtain the most recent update timestamp of the real-time performance score of each candidate AI model, and calculate the confidence decay coefficient of each real-time performance score based on the time length between the most recent update timestamp and the current time. The real-time performance scores of each candidate AI model are corrected using the confidence decay coefficient to obtain the corrected performance scores of each candidate AI model. Using the revised performance scores as weighting coefficients, the semantic relevance of each candidate AI model in the initial candidate model sequence is weighted. Based on the weighted semantic relevance, the initial candidate model sequence is reordered to obtain the preferred model execution chain corresponding to the AI call request.
[0051] The system reads the operational metrics of each candidate AI model within the most recent time window. This most recent time window can be pre-configured according to system operation and maintenance needs, such as being configured as the most recent 1 minute or the most recent 5 minutes. The operational metrics read include at least the average response time and call success rate of each candidate AI model within this time window. The average response time reflects the speed at which the model processes requests, and the call success rate reflects the reliability of the model's normal response to requests. Both, from different dimensions, jointly characterize the service quality of the model in the current time period. For each candidate AI model, a real-time performance score is calculated based on its average response time and call success rate. The calculation logic for this score is that the higher the call success rate and the shorter the average response time, the higher the real-time performance score. Conversely, the lower the call success rate and the longer the average response time, the lower the real-time performance score. This calculation can be implemented by weighted summation of the normalized values of the call success rate and response time, so that the final score is a dimensionless value.
[0052] While obtaining the real-time performance scores of each candidate AI model, we can also obtain the most recent update timestamp corresponding to each real-time performance score. This timestamp records the collection time of the operational indicator data on which the score depends. Based on the length of time between the most recent update timestamp and the current moment, we calculate the confidence decay coefficient for each real-time performance score. If the operational indicator on which a score is based was collected at an earlier time, then the reference value of that score for the true state of the model at the current moment is low, and its role in subsequent ranking should be weakened; conversely, if it was collected at a more recent time, then its reference value is high, and its role should be retained. Based on the above logic, we calculate the length of time between the most recent update timestamp and the current moment. The longer the time length, the larger the value of the confidence decay coefficient; the shorter the time length, the smaller the value of the confidence decay coefficient.
[0053] Subsequently, each real-time performance score is corrected using a confidence decay coefficient. Specifically, each real-time performance score is multiplied by the complement of the confidence decay coefficient, or other mathematical transformations are used to suppress older scores while preserving newer scores. Through this correction, a corrected performance score for each candidate AI model is obtained. This corrected score incorporates the model's actual performance information within the most recent time window and incorporates a reasonable confidence adjustment based on the timeliness of this information. This ensures that older scores have a smaller impact on subsequent rankings, while newer scores have a greater impact.
[0054] After obtaining the corrected performance scores of each candidate AI model, the semantic relevance of each candidate AI model in the initial ranking sequence is weighted using these scores as weighting coefficients. This involves multiplying the semantic relevance of each model by its corresponding corrected performance score to obtain the weighted semantic relevance of each model. Through this weighting operation, models with higher corrected performance scores will receive higher weighting results when semantic relevance is similar; conversely, models with lower corrected performance scores but extremely high semantic relevance may still maintain a high weighting result, depending on the numerical relationship between semantic relevance and the corrected performance score. Both factors jointly determine the final ranking. Based on the weighted semantic relevance of each candidate AI model, the initial ranking sequence is reordered, that is, all candidate AI models are rearranged from high to low according to their weighted semantic relevance, resulting in the optimal model execution chain corresponding to the AI call request.
[0055] In one embodiment, the step of sending probe requests to each candidate AI model in the order of the preferred model execution chain, and determining the first candidate AI model that passes the probe as the target execution model, includes: Extract the arrangement order of each candidate AI model from the preferred model execution chain, and generate the detection sequence corresponding to each candidate AI model according to the arrangement order; A probe prompt word is generated based on the prompt word content of the AI call request, and a probe request is constructed based on the probe prompt word, wherein the number of characters in the probe prompt word is less than the number of characters in the prompt word content; According to the order of the detection sequence, the detection requests are sent to each candidate AI model in sequence, and the detection responses returned by each candidate AI model are compared with the preset pass conditions. If the detection response of the current candidate AI model meets the passing condition, then the current candidate AI model is determined to have passed the detection, and the current candidate AI model is identified as the target execution model.
[0056] The system extracts the order of each candidate AI model from the execution chain of the preferred model and generates a probe sequence for each candidate AI model based on this order. The probe sequence retains the sorting result of the execution chain of the preferred model, so that in the subsequent probe process, the system can verify each model according to the priority order of comprehensive evaluation of semantic matching degree and real-time performance, and prioritize the probe of the model with the best comprehensive evaluation.
[0057] Dedicated probe prompts are generated based on the prompts carried in the original AI call request. These prompts are generated by extracting or refining a semantically complete text fragment with significantly fewer characters than the original prompt content. For example, when the original prompt content is a long document, the probe prompt can be the first sentence or the first few dozen characters. When the original prompt content is a detailed problem description, the probe prompt can extract the core keyword combination from the problem description. The reduced character count of the probe prompts compared to the original prompt content significantly shortens the time required for the model to process the probe prompts compared to processing the complete prompt content, thus reducing the waiting time for a single probe. A probe request is constructed based on the generated prompts. This probe request maintains the same request format and protocol as the complete inference request, differing only in the prompt content carried in the request body, ensuring that the probe results reliably reflect the overall usability of the model interface.
[0058] After constructing the probe request, it is sent sequentially to each candidate AI model according to the probe sequence. For the currently probed candidate AI model, after sending the probe request, the system waits for its probe response and compares the returned response with preset pass criteria. These preset pass criteria may include multiple judgment standards such as a normal response status code, a response time not exceeding a set timeout threshold, and a response body format meeting expectations. If the probe response returned by the current candidate AI model simultaneously meets all of the above pass criteria, the current candidate AI model is determined to have passed the probe, immediately designated as the target execution model, and the probe of subsequent candidate AI models in the probe sequence is terminated; no further probe requests are sent to subsequent models. If the probe response returned by the current candidate AI model fails to meet any of the pass criteria, the current candidate AI model is determined to have failed the probe, and the system continues to send probe requests to the next candidate AI model in the probe sequence, repeating the above probe and comparison process until a candidate AI model that has passed the probe is found.
[0059] For example, when Model A, Model B, and Model C are sequentially arranged in the preferred model execution chain, the system first generates a probe sequence of Model A, Model B, and Model C. Then, it extracts a short core semantic fragment from the original prompt words as a probe prompt word and constructs a probe request. A probe request is first sent to Model A. If Model A returns a response with a normal status code and the expected format within the set timeout threshold, Model A is considered to have passed the probe and is directly identified as the target execution model. Probe requests are no longer sent to Model B and Model C. If the probe response returned by Model A times out or has an abnormal status code, Model A is considered to have failed the probe, and a probe request is sent to Model B, and so on. Through this mechanism of serial probing and termination at the first successful attempt, in most cases, only one or a few models ranked high in the preferred model execution chain need to be probed to determine the target execution model, avoiding the huge overhead of sending complete inference requests to all candidate models in parallel.
[0060] Because the probe requests use lightweight probe hints, even if the first few models in the probe sequence fail, the cumulative time spent on sequential probes is still much less than the cumulative time spent sending complete inference requests sequentially, ensuring the efficiency of the overall scheduling process. Compared to directly calling the first-ranked model in the preferred model execution chain without any verification, the probe mechanism in this embodiment avoids the risk of request failure due to directly calling a faulty model because the evaluation data is inconsistent with the actual state.
[0061] Reference Figure 2 The diagram shown is a functional module schematic of the semantic matching-based model selection device 100 of this application.
[0062] Depending on the functions implemented, the semantic matching-based model selection device 100 includes a first mapping module 110, a second mapping module 120, a calculation module 130, a sorting module 140, and a selection module 150. These modules can also be referred to as units, which are a series of computer program segments that can be executed by the processor of an electronic device and perform a fixed function, stored in the memory of the electronic device.
[0063] In this embodiment, the functions of each module / unit are as follows: First mapping module 110: used to intercept AI call requests initiated by business applications, map the prompt words of AI call requests into semantic vectors, and obtain the request semantic fingerprint corresponding to the AI call request; The second mapping module 120 is used to map the capability description text of each candidate AI model into a semantic vector and store it to obtain the static capability fingerprints corresponding to each candidate AI model in the global capability fingerprint database. Calculation module 130: used to calculate the semantic correlation between the request semantic fingerprint and each of the static capability fingerprints, sort all candidate AI models according to each of the semantic correlations, and obtain the initial ranking sequence of candidate models corresponding to the AI call request; Sorting module 140: used to obtain the real-time performance score of each candidate AI model, and re-sort the semantic relevance of each model by weighting the real-time performance score to obtain the preferred model execution chain corresponding to the AI call request; Selection module 150: Used to send probe requests to each candidate AI model in the order of the preferred model execution chain, determine the first candidate AI model that passes the probe as the target execution model, and call the target execution model to perform inference operations.
[0064] The specific implementation of the semantic matching-based model selection device in this application is largely the same as the specific implementation of the semantic matching-based model selection method described above, and will not be repeated here.
[0065] Reference Figure 3 The diagram shown is a schematic representation of a preferred embodiment of the electronic device of this application.
[0066] The electronic device includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114. Memory 113 is used to store computer programs, such as a semantic matching-based model selection program; Figure 3 Only an electronic device having a processor 111, a communication interface 112, a memory 113 and a communication bus 114 is shown. However, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0067] In one embodiment of this application, when the processor 111 executes a program stored in the memory 113, it implements the semantic matching-based model selection method provided in any of the foregoing method embodiments, including: Intercept AI call requests initiated by business applications, map the prompts of AI call requests to semantic vectors, and obtain the request semantic fingerprint corresponding to the AI call request; Map the capability description text of each candidate AI model to a semantic vector and store it to obtain the static capability fingerprint corresponding to each candidate AI model in the global capability fingerprint database. Calculate the semantic correlation degree between the request semantic fingerprint and each of the static capability fingerprints, sort all candidate AI models according to each of the semantic correlation degrees, and obtain the initial ranking sequence of candidate models corresponding to the AI call request; Obtain the real-time performance score of each candidate AI model, and re-sort the semantic relevance based on the real-time performance score to obtain the preferred model execution chain corresponding to the AI call request; Probe requests are sent to each candidate AI model in the order of the preferred model execution chain. The first candidate AI model that passes the probe is determined as the target execution model, and the target execution model is invoked to perform inference operations.
[0068] For a detailed explanation of the above steps, please refer to the flowchart of the above embodiment of the semantic matching-based model selection method.
[0069] Furthermore, this application also proposes a computer-readable storage medium that is both non-volatile and volatile. This computer-readable storage medium is any one or any combination of several of the following: hard disk, multimedia card, SD card, flash memory card, SMC, read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, etc. The computer-readable storage medium includes a data storage area and a program storage area. The program storage area stores a semantic matching-based model selection program, which, when executed by a processor, performs the following operations: Intercept AI call requests initiated by business applications, map the prompts of AI call requests to semantic vectors, and obtain the request semantic fingerprint corresponding to the AI call request; Map the capability description text of each candidate AI model to a semantic vector and store it to obtain the static capability fingerprint corresponding to each candidate AI model in the global capability fingerprint database. Calculate the semantic correlation degree between the request semantic fingerprint and each of the static capability fingerprints, sort all candidate AI models according to each of the semantic correlation degrees, and obtain the initial ranking sequence of candidate models corresponding to the AI call request; Obtain the real-time performance score of each candidate AI model, and re-sort the semantic relevance based on the real-time performance score to obtain the preferred model execution chain corresponding to the AI call request; Probe requests are sent to each candidate AI model in the order of the preferred model execution chain. The first candidate AI model that passes the probe is determined as the target execution model, and the target execution model is invoked to perform inference operations.
[0070] The specific implementation of the computer-readable storage medium in this application is largely the same as the specific implementation of the semantic matching-based model selection method described above, and will not be repeated here.
[0071] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, apparatus, article, or method. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.
[0072] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware simulation platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of this application.
[0073] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A model selection method based on semantic matching, characterized in that, The method includes: Intercept AI call requests initiated by business applications, map the prompts of AI call requests to semantic vectors, and obtain the request semantic fingerprint corresponding to the AI call request; Map the capability description text of each candidate AI model to a semantic vector and store it to obtain the static capability fingerprint corresponding to each candidate AI model in the global capability fingerprint database. Calculate the semantic correlation degree between the request semantic fingerprint and each of the static capability fingerprints, sort all candidate AI models according to each of the semantic correlation degrees, and obtain the initial ranking sequence of candidate models corresponding to the AI call request; Obtain the real-time performance score of each candidate AI model, and re-sort the semantic relevance based on the real-time performance score to obtain the preferred model execution chain corresponding to the AI call request; Probe requests are sent to each candidate AI model in the order of the preferred model execution chain. The first candidate AI model that passes the probe is determined as the target execution model, and the target execution model is invoked to perform inference operations.
2. The model selection method based on semantic matching as described in claim 1, characterized in that, The method further includes: Based on the direction of the quality feedback signal of the inference result, the static capability fingerprint corresponding to the target execution model in the global capability fingerprint database is corrected by vector offset, and the corrected static capability fingerprint is updated back to the global capability fingerprint database.
3. The model selection method based on semantic matching as described in claim 1, characterized in that, The process of mapping the prompt content of the AI call request to a semantic vector to obtain the request semantic fingerprint corresponding to the AI call request includes: The text structure of the prompts in the AI call request is parsed to identify the instruction intent part, target object part, and constraint condition part in the prompts, and the prompts are then split into instruction intent text segments, target object text segments, and constraint condition text segments. Semantic encoding operations are performed on the instruction intent text segment, the target object text segment, and the constraint condition text segment respectively to generate an instruction intent vector corresponding to the instruction intent text segment, a target object vector corresponding to the target object text segment, and a constraint condition vector corresponding to the constraint condition text segment; The instruction intent vector, the target object vector, and the constraint vector are weighted and concatenated according to predetermined weights to generate the request semantic fingerprint corresponding to the AI call request.
4. The model selection method based on semantic matching as described in claim 1, characterized in that, The process of mapping the capability description text of each candidate AI model to semantic vectors and storing them to obtain static capability fingerprints corresponding to each candidate AI model in the global capability fingerprint database includes: Obtain the capability description text of each candidate AI model, and then split the capability description text into task domain text segment, capability advantage text segment, and applicable limitation text segment; Semantic encoding operations are performed on the task domain text segment, capability advantage text segment, and applicable restriction text segment corresponding to each candidate AI model to generate task domain vector, capability advantage vector, and applicable restriction vector corresponding to each candidate AI model. The task domain vector, capability advantage vector, and applicable restriction vector corresponding to each candidate AI model are concatenated in a preset order to generate a static capability fingerprint corresponding to each candidate AI model. Each static capability fingerprint is then stored in the global capability fingerprint database at the storage location corresponding to each candidate AI model.
5. The model selection method based on semantic matching as described in claim 1, characterized in that, The calculation of the semantic correlation between the request semantic fingerprint and each of the static capability fingerprints includes: Extract the instruction intent vector, target object vector, constraint vector, and weights corresponding to each vector from the request semantic fingerprint; Extract the first capability segment vector with the same dimension as the instruction intent vector, the second capability segment vector with the same dimension as the target object vector, and the third capability segment vector with the same dimension as the constraint condition vector from each static capability fingerprint. Calculate the vector distance between each group of vectors with the same dimension and generate the corresponding sub-item correlation degree based on each vector distance. The correlation of each item is weighted and summed according to the weights, and the weighted sum is used as the semantic correlation between the request semantic fingerprint and the static capability fingerprint.
6. The model selection method based on semantic matching as described in claim 1, characterized in that, The step of obtaining the real-time performance scores of each candidate AI model, and then re-sorting the semantic relevance based on the real-time performance scores to obtain the preferred model execution chain corresponding to the AI call request includes: Read the average response time and call success rate of each candidate AI model within the most recent time window, and calculate the real-time performance score of each candidate AI model based on the average response time and the call success rate; Obtain the most recent update timestamp of the real-time performance score of each candidate AI model, and calculate the confidence decay coefficient of each real-time performance score based on the time length between the most recent update timestamp and the current time. The real-time performance scores of each candidate AI model are corrected using the confidence decay coefficient to obtain the corrected performance scores of each candidate AI model. Using the revised performance scores as weighting coefficients, the semantic relevance of each candidate AI model in the initial candidate model sequence is weighted. Based on the weighted semantic relevance, the initial candidate model sequence is reordered to obtain the preferred model execution chain corresponding to the AI call request.
7. The model selection method based on semantic matching as described in claim 1, characterized in that, The step of sending probe requests to each candidate AI model in the order of the preferred model execution chain, and determining the first candidate AI model that passes the probe as the target execution model, includes: Extract the arrangement order of each candidate AI model from the preferred model execution chain, and generate the detection sequence corresponding to each candidate AI model according to the arrangement order; A probe prompt word is generated based on the prompt word content of the AI call request, and a probe request is constructed based on the probe prompt word, wherein the number of characters in the probe prompt word is less than the number of characters in the prompt word content; According to the order of the detection sequence, the detection requests are sent to each candidate AI model in sequence, and the detection responses returned by each candidate AI model are compared with the preset pass conditions. If the detection response of the current candidate AI model meets the passing condition, then the current candidate AI model is determined to have passed the detection, and the current candidate AI model is identified as the target execution model.
8. A model selection device based on semantic matching, characterized in that, The device includes: The first mapping module is used to intercept AI call requests initiated by business applications, map the prompts of AI call requests into semantic vectors, and obtain the request semantic fingerprint corresponding to the AI call request. The second mapping module is used to map the capability description text of each candidate AI model into a semantic vector and store it, so as to obtain the static capability fingerprints corresponding to each candidate AI model in the global capability fingerprint database. Calculation module: used to calculate the semantic correlation between the request semantic fingerprint and each of the static capability fingerprints, sort all candidate AI models according to each of the semantic correlations, and obtain the initial ranking sequence of candidate models corresponding to the AI call request; The sorting module is used to obtain the real-time performance scores of each candidate AI model, and then re-sort them by weighting the semantic relevance of each real-time performance score to obtain the preferred model execution chain corresponding to the AI call request. Selection module: Used to send probe requests to each candidate AI model in the order of the preferred model execution chain, determine the first candidate AI model that passes the probe as the target execution model, and call the target execution model to perform inference operations.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the semantic matching-based model selection method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the semantic matching-based model selection method as described in any one of claims 1 to 7.