Intention classification method and device based on frozen small model and dynamically invoked large model

By generating vector representations and dynamically calling large models, this method solves the problem of insufficient accuracy of small generative language models in intent classification, improves fine-grained intent discrimination and out-of-domain recognition capabilities, and controls cloud call costs. It is applicable to a variety of datasets and business domains.

CN123158340APending Publication Date: 2026-11-24SICHUAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611516866.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-28
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Under the condition that the weights of small generative language models are frozen and parameter updates are not allowed, existing technologies are difficult to improve the accuracy of intent classification, especially in fine-grained intent boundary discrimination and out-of-domain sample recognition, and there are problems such as label confusion and parsing failure.

Method used

By generating vector representations of the statements to be classified, calculating the similarity with the centroid vector of the intent, selecting a candidate set, and dynamically calling the large language model in the cloud in conjunction with routing strategies, the intent classification capability of the local small model is improved by utilizing candidate semantic evidence and structured prompts, and multiple routing strategies are provided to control cloud call traffic.

Benefits of technology

Without updating the parameters of the small model, it improves the accuracy of fine-grained intent classification and the ability to identify out-of-domain samples, reduces local computing overhead, and controls cloud API call costs. It is suitable for intent classification tasks in different datasets and business domains.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123158340A_ABST
    Figure CN123158340A_ABST
Patent Text Reader

Abstract

This invention discloses an intent classification method and apparatus based on a frozen small model and dynamic invocation of a large model. The method includes generating the similarity between each statement to be classified in the current batch and each intent in the business intent set; selecting multiple intents with the highest similarity to form a candidate set of x; generating a routing score for each x under a routing policy; selecting multiple x in the current batch whose routing scores represent higher risks based on the routing budget ratio, and combining them with the business intent set, invoking a cloud-based large language model to generate a predicted intent for each x; for x that does not invoke the cloud-based large language model, determining whether it meets preset conditions; if so, using the intent with the highest similarity as its predicted intent; otherwise, determining candidate semantic evidence for x; inputting x, its corresponding candidate set, and all candidate semantic evidence into a small generative language model with completely frozen weights and no parameter updates to obtain the predicted intent of x.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing and large language model hybrid reasoning technology, specifically to an intent classification method and apparatus based on freezing a small model and dynamically calling a large model. Background Technology

[0002] Intent classification is a core front-end module in task-oriented dialogue systems, intelligent customer service, and enterprise automation processes. Its goal is to map user natural language input to a predefined set of intent labels. In recent years, large language models (LLMs) have demonstrated powerful intent recognition capabilities under zero-shot or limited-shot conditions. However, calling high-performance cloud-based large model APIs for every request leads to a sharp increase in token call overhead and inference latency when online business traffic is huge, resulting in persistently high operating costs.

[0003] To reduce inference costs, the industry commonly uses lightweight small models (typically with 2B-3B parameters) for local intent recognition. However, in many industrial production scenarios, the weights of already deployed small models are completely frozen by business rules, preventing fine-tuning or parameter updates. Under this constraint, if all intent labels are directly input into the small model with zero-shot prompting, when the intent space is large (e.g., CLIC150 contains 150 in-domain intents and 1 out-of-domain intent), the small model will experience severe label confusion, parsing failures, and failure to recognize out-of-scope (OOS) samples. Experiments show that on the CLIC150 dataset, directly using full-label prompts, Qwen2.5-3B-Instruct, only achieves 51.13% accuracy, and Gemma-2-2B-it only achieves 54.24% accuracy, with both achieving 0% recognition rate for OOS samples.

[0004] Existing search-enhanced intent classification techniques, such as "Few-shot Intent Classification and Slot Filling with Retrieved Examples" (pp. 734-749, DOI: 10.18653 / v1 / 2021.naacl-main.59) published by Yu, He, Zhang et al. at NAACL-HLT 2021, and "In-Context Learning for Text Classification with Many Labels" (pp. 173-184, DOI: 10.18653 / v1 / 2023.genbench-1.14) published by Milios, Reddy, and Bahdanau at GenBench 2023, have used search examples or candidate labels to assist in few-shot classification. However, for intents such as calendar_update, todo_list_update, and remover_update, which are highly similar in name, it is still necessary to use real examples that are correctly aligned with the candidate intents to clarify the fine-grained semantic boundaries.

[0005] When the weights of small models cannot be finely adjusted, existing technologies cannot simultaneously meet the following three objectives: (1) improve the ability of frozen small models to discriminate at fine-grained intent boundaries; (2) provide a fallback mechanism for large models that can strictly limit the call budget; and (3) maintain the ability to effectively detect samples outside the domain. Summary of the Invention

[0006] To address the aforementioned shortcomings of existing technologies, the present invention provides an intent classification method and apparatus based on freezing small models and dynamically calling large models. This solves the problem that existing technologies struggle to effectively improve intent classification accuracy and clarify fine-grained intent boundaries under industrial deployment constraints where the weights of small generative language models are completely frozen and no parameter updates or supervised fine-tuning are permitted.

[0007] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows: Firstly, an intent classification method based on freezing a small model and dynamically invoking a large model is provided, which includes: S1. Generate a vector representation of each statement x to be classified in the current batch, calculate the similarity between each vector representation and the centroid vector of each intent in the business intent set, and select multiple intents with the highest similarity to form a candidate set of x. S2. Select a routing strategy and generate a routing score for each statement to be classified under the current routing strategy; S3. Based on the routing budget ratio, select multiple sentences to be classified that have higher risk in the current batch, and combine them with the business intent set to call the cloud-based large language model to generate the predicted intent for each sentence to be classified. S4. For the sentences to be classified in the current batch that have not called the cloud-based large language model, determine whether they meet the preset conditions. If so, use the intent with the highest similarity as its predicted intent; otherwise, proceed to step S5. S5. For each intent in the candidate set of the sentence to be classified, select representative training examples from its corresponding training samples, and combine them with the corresponding intent to form candidate semantic evidence for the sentence to be classified. S6. Input the sentence to be classified, its corresponding candidate set, and all candidate semantic evidence into a small generative language model with completely frozen weights and no parameter updates to obtain the predicted intent of the sentence to be classified.

[0008] In one possible implementation, the routing strategy is a retrieval similarity routing strategy or a multi-feature learning-based logistic regression routing strategy; for the retrieval similarity routing strategy, the maximum similarity of the statement to be classified is selected as its routing score, and the smaller the routing score, the higher the risk. For a multi-feature learning-based logistic regression routing strategy, text complexity features and retrieval ambiguity features are extracted based on the sentence to be classified and its candidate set. The text complexity features and retrieval ambiguity features are combined to form a feature vector. The feature vector is then input into the logistic regression model to obtain a routing score. At this point, the higher the routing score, the higher the risk.

[0009] In one possible implementation, the preset condition is that the difference between the highest similarity and the second highest similarity of the statement to be classified is greater than a set threshold.

[0010] In one possible implementation, the method for obtaining the intent centroid vector of each intent includes: Obtain a set of business intents, which contains N in-domain intents and one out-of-domain intent. Both in-domain intents and out-of-domain intents include several training samples. A pre-trained text embedding model is used to generate a vector representation of each training sample corresponding to each intent in the business intent set, and the average value of all vector representations corresponding to the same intent is calculated as its intent centroid vector.

[0011] In one possible implementation, the expression for obtaining the route score using a logistic regression model is:

[0012] in, σ is the route score for the statement x to be classified; σ is the sigmoid function; w is the weight vector obtained through training; b is the intercept term; To classify the statement x to be classified and its candidate set Constructed eigenvectors; This is a transpose.

[0013] In one possible implementation, when a small generative language model is used to generate a local predicted intent, its input also includes structured prompts, which include the original label name of the intent in the candidate set, the intent interpretation after human-readable processing, a representative training example corresponding to the intent, and the user-inputted sentence to be classified.

[0014] In one possible implementation, the representative training examples are selected from the training samples in a fixed order, or obtained by random resampling within the same training partition.

[0015] Secondly, an intent classification device based on freezing a small model and dynamically invoking a large model is provided, comprising: The candidate set generation module is used to generate a vector representation of each statement x to be classified in the current batch, calculate the similarity between each vector representation and the centroid vector of each intent in the business intent set, and select multiple intents with the highest similarity to form a candidate set of x. The route score generation module is used to select a route strategy and generate a route score for each statement to be classified under the current route strategy. The first intent generation module is used to select multiple sentences to be classified that have a high risk in the current batch based on the routing budget ratio, and combine them with a preset set of business intents to call the cloud-based big language model to generate the predicted intents of the selected sentences to be classified. The judgment module is used to determine whether the sentences to be classified in the current batch that have not called the cloud-based large language model meet the preset conditions. If they do, the intention with the highest similarity is used as the predicted intention; otherwise, the sentence enters the candidate semantic evidence generation module. The candidate semantic evidence generation module is used to select representative training examples from the corresponding training samples for each intent in the candidate set of the sentence to be classified, and to form candidate semantic evidence for the corresponding sentence to be classified by combining the representative training examples with the corresponding intent. The second intent generation module is used to input the sentence to be classified, its corresponding candidate set, and all candidate semantic evidence into a small generative language model with completely frozen weights and no parameter updates, to obtain the predicted intent of the sentence to be classified.

[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This solution, without updating the parameters of the small generative language model, enables the frozen small generative language model to make intent judgments by combining the semantic boundary information of candidate intents through candidate intent retrieval and corresponding semantic evidence. This improves the ability to distinguish between fine-grained similar intents and the accuracy of intent classification. By setting representative training examples, the boundaries of fine-grained intents can be accurately clarified. This solution is verified through ablation experiments with erroneous examples as controls. The benefit comes from the clarification of intent boundaries by true aligned examples, rather than the increase in the length of the prompt text. This feature is suitable for industrial constraints where many online businesses prohibit updating the weights of small models.

[0017] 2. Provides multiple optional routing strategies to strictly control the traffic budget for API calls to the large cloud model. By generating a routing score before inference in the small generative language model and selecting high-risk requests to call the large cloud language model based on the preset routing budget, the proportion of calls to the large cloud language model can be limited while allowing more difficult-to-identify requests to be handled by the more capable large model, thus balancing intent classification accuracy and external API call costs. For requests that are pre-routed, inference in the local small model can be skipped, reducing local computational overhead.

[0018] 3. The solution possesses cross-dataset transfer capabilities. It has been validated on three publicly available intent datasets: CLIC150, BANKING77, and HWU64. This solution does not rely on a specific intent dataset and is applicable to intent classification tasks of different category sizes and business domains. With the parameters of a small generative language model kept frozen, by using candidate intent retrieval and candidate semantic evidence to assist classification, it can improve the fine-grained intent discrimination capability in different intent classification tasks, demonstrating good cross-dataset applicability.

[0019] 4. The technology has clear boundaries and does not encroach on existing technological space. When the business environment allows for supervised fine-tuning of small models, trained encoder classifiers (such as MPNet-Energy, achieving 90.05% on CLIC150) perform better; direct centroid retrieval (151-centroid top-1, 80.71%) also outperforms small generative language models that rely on candidate sets and combine candidate semantic evidence in some scenarios. This invention is specifically designed for deployment scenarios where model weights must be frozen and fine-tuning is prohibited, complementing rather than replacing existing technologies.

[0020] 5. Balancing OOS detection and cost control. This solution incorporates OOS as the N+1th tag into the retrieval index and uses OOS-aware hints in the cloud-based big model fallback stage. By including out-of-domain intents as part of a predefined intent system in candidate retrieval and employing out-of-domain awareness hints in the cloud-based big model fallback stage, the system's ability to identify out-of-domain requests can be enhanced. Attached Figure Description

[0021] Figure 1 This is a flowchart of an intent classification method based on freezing a small model and dynamically invoking a large model.

[0022] Figure 2 A schematic diagram illustrating the process of constructing and freezing small models for SCA hints and reordering.

[0023] Figure 3 This is a schematic diagram of the decision-making process for the selective SCA downgrade variant. Detailed Implementation

[0024] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.

[0025] refer to Figure 1 , Figure 1 The flowchart illustrates an intent classification method based on freezing a small model and dynamically invoking a large model, as shown below. Figure 1 As shown, the method S includes steps S1 to S6.

[0026] In this solution, before performing online intent classification, it is first necessary to generate the intent centroid vector for each intent in the business intent set offline, so that it can be directly read online. The methods for determining the intent centroid vector include: Obtain a set of business intents, which includes N in-domain intents and one out-of-domain intent (i.e., the out-of-domain OOS category). Both in-domain and out-of-domain intents include several training samples (specifically: collect multiple training sample utterances corresponding to each intent; for the out-of-domain OOS category, collect M training samples labeled as OOS). A pre-trained text embedding model (preferably a BGE series embedding model) is used to generate a vector representation of each training sample corresponding to the intent, and the average of all vector representations corresponding to each intent is calculated as the centroid vector of the corresponding intent. Let D be the set of training samples corresponding to intent y. y The number of training samples is denoted as n. y The j-th training sample is denoted as If the embedding function is e(·), then the intended centroid vector is... The calculation formula is:

[0027] in, The number of training samples representing the intent y, i.e., the training sample set. The cardinality of ; e(·) represents the embedding function. For out-of-domain OOS categories, average their M training samples to generate OOS centroid vectors, and construct the intent vector retrieval index library together with the intent centroids of each domain.

[0028] In this solution, the set of business intents is the CLIC150 dataset, the BANKING77 dataset, or the HWU64 dataset.

[0029] In step S1, a vector representation of each statement x to be classified in the current batch is generated. The similarity between each vector representation and the centroid vector of each intent in the business intent set is calculated. Multiple intents with the highest similarity are selected to form a candidate set of x. Examples of statements to be classified include: "Reschedule tomorrow's 3 PM meeting to 4 PM" → calendar_update; "Remind me to take my medicine at 8 PM" → reminder_update; "Add buying milk to my to-do list" → todo_list_update.

[0030] For inputs that do not fall within the scope of the business intent set, such as "What will the weather be like tomorrow?" (assuming the current business intent set does not contain weather queries), the target output is OOS.

[0031] Cosine similarity is used to calculate the similarity between the vector representation and the centroid vector of each intent in the business intent set. Multiple intents with the highest similarity are selected to form a candidate set. The cosine similarity and candidate set calculations are as follows:

[0032]

[0033] in, Let x be the vector representation of the statement to be classified. The centroid vector of the intention; for and Similarity; Let x be the candidate set; The set of all intent tags (including domain-specific intents and OOS categories), where K is the preset number of candidates; It is a quadratic norm.

[0034] Regarding the value of K, on ​​multiple datasets including CLIC150 (151 classes), BANKING77 (77 classes), and HWU64 (64 classes), K=5 was chosen to achieve a higher candidate recall rate while limiting the candidate size processed by subsequent smaller models. Experiments showed that when K=5, BGE semantic retrieval achieved a candidate recall rate of 92.16% on the CLIC150 test set and approximately 98.7% on BANKING77 and HWU64.

[0035] It should be noted here that the OOS category participates in the retrieval as the N+1th tag. Candidate Set The small model will only output an OOS prediction when an OOS is retrieved and enters the Top-K; it will not provide an additional "none of the above" button without prior retrieval. The OOS detection capability is directly constrained by the retrieval recall rate. Experiments show that BGE top-5 retrieval achieves a 99.51% recall rate for in-domain samples and a 59.10% recall rate for OOS samples on CLIC150, with the latter constituting the upper bound of the small model's OOS recognition accuracy.

[0036] In step S2, a routing strategy is selected, and a routing score for each statement to be classified is generated under the current routing strategy.

[0037] In this scheme, the routing strategy is either a retrieval similarity routing strategy or a multi-feature learning-based logistic regression routing strategy. For the retrieval similarity routing strategy, the maximum similarity of the statement to be classified is selected as its routing score. In this case, the smaller the routing score, the higher the risk. For a multi-feature learning-based logistic regression routing strategy, text complexity features and retrieval ambiguity features are extracted based on the sentence to be classified and its candidate set. The text complexity features and retrieval ambiguity features are combined to form a feature vector. The feature vector is then input into the logistic regression model to obtain a routing score. At this point, the higher the routing score, the higher the risk.

[0038] In step S3, based on the routing budget ratio, select multiple sentences with higher risk in the current batch that are to be classified according to the routing score, and combine them with the business intent set to call the cloud-based large language model to generate the predicted intent for each sentence to be classified; the preset routing budget ratio r has a value range of 0 to 1, including 0 and 1, which represents the upper limit of the traffic of all requests in the budget control object that are allowed to be forwarded to the cloud-based large model L.

[0039] In step S4, for the sentences to be classified in the current batch that have not invoked the cloud-based large language model, it is determined whether they meet the preset conditions. If so, the intent with the highest similarity is used as the predicted intent; otherwise, proceed to step S5.

[0040] The preset condition is that the difference between the highest and second-highest similarity scores of the statements to be classified is greater than a set threshold. This preset condition, when the intent can be accurately determined, eliminates the need to enter the local small model prediction stage, thus reducing computational overhead to some extent. Steps S4 to S6 constitute the selective SCA downgrade variant decision process, the implementation of which can be found in [reference needed]. Figure 3 .

[0041] In step S5, for each intent in the candidate set of the statement to be classified, a representative training example is selected from its corresponding training sample, and it and the corresponding intent are used to form the candidate semantic evidence of the statement to be classified.

[0042] Representative training examples in this scheme can be selected from the training file in a fixed order, or randomly resampled within the same training partition. However, these examples must be training statements whose true utterance belongs to that intent, and not examples from other intents. All candidate semantic evidence corresponding to the input statement x to be classified constitutes the following set:

[0043] in, For the complete set of candidate semantic evidence for the statement x to be classified; for Any candidate intent in; for Representative training samples.

[0044] In step S6, the sentence to be classified, its corresponding candidate set, and all candidate semantic evidence are input into a small generative language model with completely frozen weights and no parameter updates, to obtain the predicted intent of the sentence to be classified.

[0045] In this approach, the small generative language model can be either Qwen2.5-3B-Instruct or Gemma-2-2B-it, with 2B-3B parameters. To improve the accuracy of the small generative language model's predictions, this approach includes structured prompts as input when generating local predicted intents. The construction process of the structured prompts can be found in [reference needed]. Figure 2 In this scheme, SCA refers to the process of generating predicted intents by executing steps S5 and S6. The structured prompts include the original label names of the intents in the candidate set, the intent interpretation after human-readable processing, a representative training example corresponding to the intent, and the user-inputted sentence to be classified.

[0046] Small generative language models receive structured cues and a set of candidate intents. and its complete set of candidate semantic evidence Subsequently, joint reranking is performed within the candidate set, rather than scoring each candidate independently. The candidate intent with the highest output probability is used as the local predicted intent. :

[0047] in, This represents the conditional generation probability of the frozen small model S; It represents the set of all candidate semantic evidence corresponding to the current input, with each candidate intent being bound to its own representative training example.

[0048] In implementation, this scheme preferably includes a human-readable paraphrase d(y) generated from or pre-defined by the label name for each candidate semantic evidence. Experiments show that this joint generative re-ranking method significantly outperforms the frozen BGE cross-encoder's independent scoring method: under the same Top-5 candidate input conditions, the optimal construction accuracy (structured + 1ex.) of the BGE cross-encoder (bge-reranker-base) is only 59.89%, while Qwen SCA reaches 76.13% and Gemma SCA reaches 76.15%, a difference of more than 16 percentage points.

[0049] To verify whether the performance improvement of SCA truly stems from the real semantic alignment between candidate intents and representative training examples, rather than solely from increased prompt text length or changes in prompt format, while keeping the BGE Top-5 candidate set, structured prompt template, small generative language model, and decoding settings unchanged, we only changed the representative training examples bound to each candidate intent, setting up three sets of controls: correct examples, offset error examples, and random error examples.

[0050] In this setup, correct examples are real examples from the candidate intent's own training set; offset error examples are generated by deterministically offsetting the label of a candidate intent to another training example of an incorrect intent; and random error examples are randomly selected training examples that do not belong to the candidate intent. Subsequently, a fully frozen small generative language model is used to determine the candidate intent, and the intent classification performance under the three settings is compared.

[0051] On the CLIC150 test set, when Qwen2.5-3B-Instruct is used as the frozen small generative language model, the overall intent classification accuracy is 76.13% under the correct sample setting, 72.69% under the deterministic offset error sample setting, and 72.04% under the random error sample setting. With the candidate set, cue structure, and model parameters all kept consistent, the correct alignment samples achieve the highest classification accuracy, indicating that the performance gain of SCA mainly comes from the semantic alignment between candidate intents and their real training samples, rather than simply increasing the length of the cue text.

[0052] In this scheme, the retrieval similarity routing strategy is executed before the inference of the small generative language model (Pre-generation). The routed requests can completely skip the inference process of the small generative language model, thereby further reducing local computing power consumption.

[0053] To verify the effectiveness of the retrieval similarity routing strategy, a real-world cloud API cascading experiment was conducted on 5,500 unclassified statements in the CLIC150 test set. First, a BGE embedding model was used to calculate the cosine similarity between each unclassified statement and its Top-1 candidate intent centroids. The statements were then sorted from lowest to highest similarity, with the request with the lowest similarity considered a high-risk request. Cloud-based large model call budgets of 10% and 20% were set respectively. High-risk requests within the budget were directly forwarded to the Qwen3.7-Max cloud-based large language model for intent prediction; the remaining unrouted requests used the frozen SCA local prediction results of a small generative language model.

[0054] During the experiment, the candidate retrieval, cloud-based large model OOS-aware prompting method, and decoding settings remained unchanged; the routing object was determined only based on the Top-1 retrieval similarity. Experimental results show that with a 10% budget, the overall accuracy reached 82.89%, and the OOS F1 score reached 70.00%; with a 20% budget, the overall accuracy reached 88.07%, and the OOS F1 score reached 87.47%.

[0055] For multi-feature learning-based logistic regression routing strategies, methods for generating routing scores based on candidate sets and the statements to be classified include: based on the statements to be classified... and candidate set Extract text complexity features and retrieval ambiguity features, combine them to form a feature combination, and then form a feature vector from the feature combination. The feature vector is then input into a logistic regression model to obtain a route score. .

[0056] Where σ is the sigmoid function, w is the learned weight vector, and b is the intercept term. For transpose; Statements to be categorized The retrieved Top-K candidate intents; This represents a feature mapping function used to extract ambiguity features and text complexity features.

[0057] During the offline training phase, the logistic regression model is trained with the validation set freezing small generative language model as a supervision label to supervise whether the sentence to be classified is predicted incorrectly. During the deployment phase, the route score is generated only based on the retrieval ambiguity features and text complexity features of the sentence to be classified, without relying on the prediction results of the frozen small generative language model.

[0058] In a CLIC150 real-world API cascading experiment, retrieval similarity routing strategy A was validated under two frozen small models (Qwen and Gemma) and two budget settings (10% and 20%). This strategy requires no additional router training and can determine the requests to be forwarded based on Top-1 retrieval similarity before the small model is generated, allowing the routed requests to skip local small model inference. Experimental results show that, compared with various existing routing strategies, this strategy achieves the highest overall accuracy in three out of four backbone-budget settings and the highest OOS F1 in all four settings, demonstrating robust overall performance.

[0059] Furthermore, an offline oracle diagnostic was performed on the pre-processing multi-feature logistic regression routing strategy C, which only uses retrieval ambiguity features and text complexity features of the sentences to be classified. This strategy can generate routing scores before small model inference and does not rely on the small model prediction results during the deployment phase; the relevant results are only used to verify the feasibility of this pre-processing learning-based routing mechanism and are not used as real-world cloud API cascading performance.

[0060] The "offline oracle diagnostics" here refers to the following: First, based on the routing score generated by the front-end learning router, requests are selected for forwarding according to a preset budget ratio without using the real labels of test samples in the routing decision. Then, only in the offline evaluation phase, it is assumed that all selected requests can be correctly classified by the cloud-based large model, that is, their prediction results are regarded as the corresponding real intent labels, while requests not forwarded still use the local prediction results, and the overall cascading accuracy is calculated accordingly. This result is used to measure the ability of the routing strategy to select high-risk requests and the theoretical upper bound of the corresponding budget, and does not represent the actual cascading performance of the real cloud-based large model API.

[0061] To verify the selective SCA mechanism, the difference between the highest and second-highest retrieval similarity for each sentence to be classified was calculated on the CLIC150 validation set, and different thresholds τ were scanned. After selecting a corresponding threshold based on the preset target SCA trigger ratio, this threshold was fixed and directly applied to the test set without further adjustment based on test results. For sentences to be classified in the test set whose similarity difference was less than or equal to the threshold, a frozen small generative language model was invoked, and predicted intents were generated by combining Top-K candidate intents and their corresponding representative training examples. For sentences to be classified that did not meet the trigger conditions, the intent corresponding to the highest similarity was directly used as the prediction result. Using the Top-1 retrieval of the direct intent centroid as a baseline, the changes in overall classification accuracy and the number of correct predictions under different target trigger ratios were compared.

[0062] Experiments show that on CLIC150, when the target trigger rate for the validation set is 5%, the actual trigger rate for the test set is 8.62%, and the overall accuracy improves from 80.71% for direct retrieval to 81.18% (Qwen) or 81.13% (Gemma), with a net increase of 26 or 23 correct predictions, and 95% confidence intervals of [+0.05, +0.89] and [+0.04, +0.80] percentage points, respectively. When the target trigger rate is not less than 10%, the confidence interval contains zero or negative values. Therefore, this variant is only suitable for narrow-range, low-score-difference trigger scenarios, used to further reduce the computational cost of local small model inference, rather than replacing direct retrieval.

[0063] This solution also provides an intent classification device based on freezing a small model and dynamically calling a large model, which includes: The candidate set generation module is used to generate a vector representation of each statement x to be classified in the current batch, calculate the similarity between each vector representation and the centroid vector of each intent in the business intent set, and select multiple intents with the highest similarity to form a candidate set of x. The route score generation module is used to select a route strategy and generate a route score for each statement to be classified under the current route strategy. The first intent generation module is used to select multiple sentences to be classified that have a high risk in the current batch based on the routing budget ratio, and combine them with a preset set of business intents to call the cloud-based big language model to generate the predicted intents of the selected sentences to be classified. The judgment module is used to determine whether the sentences to be classified in the current batch that have not called the cloud-based large language model meet the preset conditions. If they do, the intention with the highest similarity is used as the predicted intention; otherwise, the sentence enters the candidate semantic evidence generation module. The candidate semantic evidence generation module is used to select representative training examples from the corresponding training samples for each intent in the candidate set of the sentence to be classified, and to form candidate semantic evidence for the corresponding sentence to be classified by combining the representative training examples with the corresponding intent. The second intent generation module is used to input the sentence to be classified, its corresponding candidate set, and all candidate semantic evidence into a small generative language model with completely frozen weights and no parameter updates, to obtain the predicted intent of the sentence to be classified.

[0064] The technical solution of the present invention will be further described in detail below with reference to several embodiments. Those skilled in the art should know that the following embodiments are only used to explain the present invention and are not intended to limit the scope of protection.

[0065] Example 1: The business intent set is the CLIC150 dataset. Dataset: CLIC150 (Larson et al., 2019), containing 150 in-domain intents plus 1 out-of-domain OOS category, for a total of 151 intent labels. The training set contains 15,000 in-domain samples and 100 labeled OOS samples; the validation set contains 3,000 in-domain samples and 100 OOS samples; the test set contains 4,500 in-domain samples and 1,000 OOS samples, for a total of 5,500 test requests.

[0066] Offline preprocessing: The BGE embedding model is used. In this embodiment, BAAI / bge-base-en-v1.5 is employed. Embedding is performed on all training samples for each intent class, and the average is calculated to generate 151 intent centroid vectors (including one OOS centroid). These centroid vectors are then used to form an intent vector retrieval matrix. During online inference, the similarity between the vector representation of the statement to be classified and the centroid vectors of each intent is calculated. Top-K candidate intents are selected based on similarity, from highest to lowest.

[0067] Online reasoning stage: After user input query is embedded using BGE, similarity is calculated between it and the intent centroid vector, and the Top-5 candidates are selected. On the CLIC150 test set, the Top-5 candidate recall rate is 92.16% (99.51% within the domain, 59.10% for out-of-domain responses).

[0068] Strategy A (retrieval similarity routing) is selected. The cosine similarity between the query and the centroid of the Top-1 candidate is calculated. The request with the lowest similarity, r, is forwarded to the cloud big model. The budget ratios are set to r=10% and r=20% respectively.

[0069] Cloud-based large-scale model as a fallback: For a routed request, an OOS-aware Prompt is constructed based on the statement to be classified and the complete set of predefined intent tags, and the Qwen3.7-Max cloud API is invoked. The complete set of predefined intent tags includes all domain intent tags and the OOS tag; the OOS-aware Prompt instructs the cloud-based large-scale language model to output a predicted intent from the complete set of intent tags, and to output OOS if the statement to be classified does not belong to any domain intent.

[0070] For unrouted requests, if a small generative language model is needed during the implementation process, a structured hint containing the intent name, definition, and representative examples is constructed for each intent in the Top-5 candidates. Figure 2 The template shown is used to assemble a complete Prompt. A fully frozen Qwen2.5-3B-Instruct (temperature=0, top_p=1, maximum generation length 16 tokens, ensuring deterministic output) is then fed into the model. The model jointly reorders the 5 candidates and outputs the predicted intent. Evaluation metrics and implementation results are shown in Table 1.

[0071] Table 1

[0072] Cost calculation basis: Based on the pricing of DashScope qwen3.7-max-2026-05-20 during the experiment, the input token cost was 12 yuan / million, and the output token cost was 36 yuan / million. On the CLIC150 test set with 5500 requests, routed calls with 10% budget consumed approximately 338,900 tokens, and calls with 20% budget consumed approximately 677,700 tokens. This translates to an external API cost of approximately 0.74 yuan and 1.49 yuan per thousand queries, respectively. Local small model inference costs were counted as zero external cost.

[0073] Example 2: Cross-dataset validation of BANKING77 and HWU64 To verify the applicability of the SCA method on different intent classification datasets, cross-dataset validation was conducted on BANKING77 and HWU64. For each dataset, the BGE semantic retrieval process, consistent with the CLIC150 experiment, was first used to embed the training samples for each intent category and calculate the category centroids. For each sentence to be classified, its similarity to the centroids of each intent was calculated, and the Top-5 candidate intents were selected. Subsequently, for each candidate intent, a representative training example belonging to that intent was selected. The candidate intent, the corresponding representative training example, and the sentence to be classified were used to construct a structured prompt, and the parameters of the Qwen2.5-3B-Instruct and Gemma-2-2B-it, respectively, were input with completely frozen parameters. A small generative language model output the predicted intent from the Top-5 candidate intents. No fine-tuning or parameter updates were performed on the small generative language model throughout the process. The experimental partitions of BANKING77 and HWU64 did not include OOS samples, so this part mainly evaluates the in-domain intent classification accuracy and compares it with the re-ranking method that only uses candidate labels and does not include representative training examples.

[0074] The candidate intent retrieval and SCA local classification process were performed using the frozen Qwen2.5-3B-Instruct and Gemma-2-2B-it small models respectively, with the number of candidates K=5, and no cloud-based large model routing was performed.

[0075] BANKING77: 77 banking sector intentions, no OOS. Qwen SCA reached 79.29%, an improvement of +4.84 points compared to label-only reordering (74.45%); Gemma SCA reached 77.82%, an improvement of +15.74 points compared to label-only (62.08%). SetFitMPNet fine-tuned baseline was 89.51%.

[0076] HWU64: 64 types of home voice assistant intents, no OOS. Qwen SCA reached 80.39%, an improvement of +6.23 points compared to label-only (74.16%); Gemma SCA reached 80.11%, an improvement of +9.39 points compared to label-only (70.72%). SetFitMPNet fine-tuned baseline was 91.08%.

[0077] The results show that, on the BANKING77 and HWU64 datasets with different intent category sizes and business semantic distributions, the classification accuracy of the frozen small generative language model is improved after introducing representative training examples that are aligned with the true candidate intents. This indicates that the SCA method does not depend on the specific CLIC150 dataset and has good cross-dataset applicability.

[0078] Example 3: Selective SCA downgrade variant implementation, i.e., determining the local predictive intent of the statement x to be classified based on the similarity in step S1. On the CLIC150 validation set, different thresholds for the similarity margin between Top-1 and Top-2 retrievals were scanned, and a threshold τ that made the SCA trigger rate close to 5% was selected. This threshold was then directly applied to the test set.

[0079] The actual trigger rate on the test set was 8.62%. Full SCA reordering was performed on triggered queries, while the centroid-based Top-1 results were directly output on non-triggered queries. The final accuracy for Qwen was 81.18%, and for Gemma it was 81.13%, representing a net increase of 26 and 23 correct predictions respectively compared to directly retrieving the Top-1 (80.71%); the 95% confidence intervals were [+0.05, +0.89] and [+0.04, +0.80] percentage points respectively.

[0080] When the target trigger rate of the validation set is adjusted to 10%, the actual trigger rate of the test set is approximately 17.16%. The net change confidence interval includes zero and there is no statistically significant gain. Therefore, this variant is only suitable for narrow-range low-margin triggering scenarios.

[0081] Example 4: Comparative Experiment of Multiple Ablation Groups To demonstrate the accuracy of the classification and precise determination of the intent boundary of this invention, the following ablation comparison was performed on CLIC150: 1) SCA, Label Reordering Only, and Error Sample Comparison Labels only (BGE labels): Qwen 68.18%, Gemma 66.02%; SCA correct examples (BGE+1ex.): Qwen 76.13%, Gemma 76.15%; Shifted error examples (Shifted): Qwen 72.69%, Gemma 70.45%; Random error examples (Random): Qwen 72.04%, Gemma 71.42%.

[0082] In the preceding paragraph, all percentages represent the overall intent classification accuracy on the CLIC150 test set. The experiments were conducted under the same BGE Top-5 candidate set and frozen small model conditions, only changing the semantic evidence attached to the candidate intents. Specifically, "Label Only" provides only Top-5 candidate labels to the frozen Qwen / Gemma; "Correct Example" attaches one true training example of that intent to each candidate intent; "Offset Error Example" binds training examples of other intents to candidate intents through deterministic label offset; and "Random Error Example" randomly binds error examples of other intents. After the model outputs the predicted intent, it is compared with the true intent label of each sample in the CLIC150 test set to calculate the overall classification accuracy. Therefore, Qwen 68.18% means that under the "Label Only" setting, the overall classification accuracy of Qwen2.5-3B-Instruct on the CLIC150 test set is 68.18%, and the other values ​​are calculated similarly.

[0083] Analysis shows that correct examples are significantly better than incorrect examples, proving that the benefit comes from clarifying the intent boundary, rather than from increasing the length of the prompt.

[0084] 2) SCA and frozen BGE cross encoders With the same Top-5 candidate inputs, the best construction of frozen bge-reranker-base (structured+1ex.) has an accuracy of only 59.89%, while SCA generative re-ranking (Qwen / Gemma) reaches 76.13% / 76.15%, a difference of more than 16 points.

[0085] 3) Experimental verification of the pre-routing strategy In a real-world API cascading experiment, strategy A (retrieval similarity routing strategy) was validated, while offline Oracle diagnostics were performed on multi-feature learning-based logistic regression routing strategy C. Strategy C does not rely on small model prediction results or use failure graphs during deployment; selected requests can directly skip freezing small model inference.

[0086] In CLIC150 oracle diagnostics, the upper bound of accuracy for Qwen with 10% / 20% budget is 83.11% / 89.42% (i.e., the theoretical upper bound of overall accuracy is 83.11% and 89.42% respectively with 10% and 20% routing budgets), and for Gemma it is 83.42% / 89.49%. These results are theoretical diagnostic results and should not be considered as real-world large-scale model API cascading performance.

[0087] In summary, this solution can effectively improve the accuracy of intent classification and clarify the boundaries of fine-grained intents. At the same time, it can strictly and controllably constrain the API call traffic budget of the cloud-based large model. Under the set budget ratio, user queries with high ambiguity risk are selectively forwarded to the cloud-based paid large model for fallback prediction, thereby achieving a balance between recognition accuracy, out-of-domain detection capability and inference cost.

Claims

1. An intent classification method based on freezing a small model and dynamically calling a large model, characterized in that, Including the following steps: S1. Generate a vector representation of each statement x to be classified in the current batch, calculate the similarity between each vector representation and the centroid vector of each intent in the business intent set, and select multiple intents with the highest similarity to form a candidate set of x. S2. Select a routing strategy and generate a routing score for each statement to be classified under the current routing strategy; S3. Based on the routing budget ratio, select multiple sentences to be classified that have higher risk in the current batch, and combine them with the business intent set to call the cloud-based large language model to generate the predicted intent for each sentence to be classified. S4. For the sentences to be classified in the current batch that have not called the cloud-based large language model, determine whether they meet the preset conditions. If so, use the intent with the highest similarity as its predicted intent; otherwise, proceed to step S5. S5. For each intent in the candidate set of the sentence to be classified, select representative training examples from its corresponding training samples, and combine them with the corresponding intent to form candidate semantic evidence for the sentence to be classified. S6. Input the sentence to be classified, its corresponding candidate set, and all candidate semantic evidence into a small generative language model with completely frozen weights and no parameter updates to obtain the predicted intent of the sentence to be classified.

2. The intent classification method according to claim 1, characterized in that, The routing strategy is either a retrieval similarity routing strategy or a multi-feature learning logistic regression routing strategy. For the retrieval similarity routing strategy, the maximum similarity of the statement to be classified is selected as its routing score. In this case, the smaller the routing score, the higher the risk. For a multi-feature learning-based logistic regression routing strategy, text complexity features and retrieval ambiguity features are extracted based on the sentence to be classified and its candidate set. The text complexity features and retrieval ambiguity features are combined to form a feature vector. The feature vector is then input into the logistic regression model to obtain a routing score. At this point, the higher the routing score, the higher the risk.

3. The intent classification method according to claim 1 or 2, characterized in that, The preset condition is that the difference between the highest similarity and the second highest similarity of the statement to be classified is greater than a set threshold.

4. The intent classification method according to claim 1, characterized in that, The methods for obtaining the centroid vector of each intent include: Obtain a set of business intents, which contains N in-domain intents and one out-of-domain intent. Both in-domain intents and out-of-domain intents include several training samples. A pre-trained text embedding model is used to generate a vector representation of each training sample corresponding to each intent in the business intent set, and the average value of all vector representations corresponding to the same intent is calculated as its intent centroid vector.

5. The intent classification method according to claim 1, characterized in that, The expression for the route score obtained using the logistic regression model is as follows: in, σ is the route score for the statement x to be classified; σ is the sigmoid function; w is the weight vector obtained through training; b is the intercept term; To classify the statement x to be classified and its candidate set Constructed eigenvectors; This is a transpose.

6. The intent classification method according to claim 1, characterized in that, When generating local predicted intents using a small generative language model, the input also includes structured prompts, which include the original label name of the intent in the candidate set, the intent interpretation after human-readable processing, a representative training example corresponding to the intent, and the user-inputted sentence to be classified.

7. The intent classification method according to claim 1, characterized in that, The representative training examples are selected from the training samples in a fixed order, or obtained by random resampling within the same training partition.

8. The intent classification method according to claim 1, characterized in that, In step S1, five corresponding intentions with the highest similarity are selected to form a candidate set of x.

9. An intent classification device based on freezing a small model and dynamically calling a large model, characterized in that, include: The candidate set generation module is used to generate a vector representation of each statement x to be classified in the current batch, calculate the similarity between each vector representation and the centroid vector of each intent in the business intent set, and select multiple intents with the highest similarity to form a candidate set of x. The route score generation module is used to select a route strategy and generate a route score for each statement to be classified under the current route strategy. The first intent generation module is used to select multiple sentences to be classified that have a high risk in the current batch based on the routing budget ratio, and combine them with a preset set of business intents to call the cloud-based big language model to generate the predicted intents of the selected sentences to be classified. The judgment module is used to determine whether the sentences to be classified in the current batch that have not called the cloud-based large language model meet the preset conditions. If they do, the intention with the highest similarity is used as the predicted intention; otherwise, the sentence enters the candidate semantic evidence generation module. The candidate semantic evidence generation module is used to select representative training examples from the corresponding training samples for each intent in the candidate set of the sentence to be classified, and to form candidate semantic evidence for the corresponding sentence to be classified by combining the representative training examples with the corresponding intent. The second intent generation module is used to input the sentence to be classified, its corresponding candidate set, and all candidate semantic evidence into a small generative language model with completely frozen weights and no parameter updates, to obtain the predicted intent of the sentence to be classified.