Assessment method and device of large language model, electronic equipment and intelligent agent
By extracting features and performing intra-class space analysis on the hidden representations of large language models, the problem of difficulty in evaluating model performance under generative classification methods is solved, interpretable evaluation results are provided, and the classification accuracy and stability of the model in multi-semantic scenarios are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING BAIDU NETCOM SCI & TECH CO LTD
- Filing Date
- 2026-01-22
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies struggle to effectively evaluate the classification performance of large language models using generative classification methods, especially when faced with ambiguous class boundaries, loose intra-class distribution, and semantic diversity. Traditional evaluation metrics cannot accurately measure the model's learning stability and classification ability.
By leveraging the hidden representations within a large language model, classification performance analysis is performed, including feature extraction, intra-class spatial analysis, and clustering. This quantitatively evaluates the model's understanding and learning effectiveness of the semantic structure within categories, and provides interpretable evaluation results using methods such as intra-class evaluation metrics and anomaly silhouette coefficients.
It achieves a stable and interpretable evaluation of the classification performance of large language models, quantifies the model's ability to learn the semantic structure within categories, and improves classification accuracy and stability in multi-semantic scenarios.
Smart Images

Figure CN121980221A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and more particularly to the fields of deep learning, large models and big data technology, specifically to an evaluation method, apparatus, electronic device and intelligent agent for a large language model. Background Technology
[0002] With the development of artificial intelligence technology, the application scenarios of large language models (LLMs) are constantly increasing. For example, large language models are used to perform classification tasks, and the evaluation of their classification performance is also crucial. Summary of the Invention
[0003] This disclosure provides a method, apparatus, electronic device, and intelligent agent for evaluating large language models.
[0004] According to one aspect of this disclosure, an evaluation method for a large language model is provided, comprising: processing multiple sample texts separately using the large language model to obtain category features of each sample text, wherein the sample texts include instruction subtexts, the instruction subtexts are used to guide the large language model to generatively output the category of the sample texts, and the category features are mapped through the output layer of the large language model to obtain the category; and evaluating the classification performance of the multiple category features based on the category labels of each of the multiple sample texts to obtain an evaluation result of the classification performance of the large language model.
[0005] According to another aspect of this disclosure, an evaluation apparatus for a large language model is provided, comprising: a feature acquisition module for processing multiple sample texts using the large language model to obtain category features for each of the multiple sample texts, wherein the sample texts include instruction subtexts, the instruction subtexts being used to guide the large language model to generatively output the categories of the sample texts, and the category features being mapped through the output layer of the large language model to obtain the categories; and an evaluation module for evaluating the classification performance of the multiple category features based on the category labels of the multiple sample texts, to obtain an evaluation result of the classification performance of the large language model.
[0006] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method described above.
[0007] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the method described above.
[0008] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described above.
[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0010] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0011] Figure 1 An exemplary system architecture of an evaluation method and apparatus applicable to large language models according to embodiments of this disclosure is illustrated.
[0012] Figure 2 A flowchart illustrating an evaluation method for a large language model according to an embodiment of the present disclosure is shown schematically.
[0013] Figure 3 The illustration depicts a scenario in which evaluation results are determined through intra-class space analysis according to an embodiment of the present disclosure.
[0014] Figure 4A A scene diagram illustrating multiple intra-class subclusters according to embodiments of the present disclosure is shown schematically.
[0015] Figure 4B The illustration schematically depicts a scenario diagram of anomaly features within a category having a multi-semantic structure according to an embodiment of the present disclosure.
[0016] Figure 5 The illustration depicts a scenario diagram for determining a confusion index value according to an embodiment of the present disclosure.
[0017] Figure 6 The illustration depicts a scenario in which evaluation results are determined through intra-class space analysis according to an embodiment of the present disclosure.
[0018] Figure 7 A block diagram of an evaluation apparatus for a large language model according to an embodiment of the present disclosure is shown schematically.
[0019] Figure 8 A schematic block diagram of an artificial intelligence agent according to an embodiment of the present disclosure is shown.
[0020] Figure 9 A block diagram of an electronic device suitable for implementing an evaluation method for large language models according to an embodiment of the present disclosure is shown schematically. Detailed Implementation
[0021] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0022] The relevant LLM classification methods mainly include two types: directly outputting class probabilities by adding a classification head on top of the LLM and training it; or, outputting classes in a generative manner by fine-tuning the model through instruction.
[0023] For example, methods that add a classification head commonly use encoder-only models like BERT and RoBERTa as a foundation, adding a fully connected layer on top as the classification head, and training with cross-entropy loss. This approach has a clear training process, and the class probabilities output by a linear classifier (such as softmax) provide directly usable classification confidence. However, it requires modification and retraining of the model structure, and the model parameter size increases with the number of classes, making evaluation efficiency highly dependent on the number of classes. Furthermore, this method struggles to accurately evaluate classification performance for data characterized by long-tail imbalance, ambiguous class boundaries, and semantic diversity within labels.
[0024] Generative classification methods with fine-tuning typically employ decoder-only models with a generative structure, which do not require an additional classifier head. Since generative classification does not make decisions through a linear classifier, it is difficult to interpret using the softmax weights of a linear classifier, and it is also difficult to obtain a reliable judgment solely from the final output category. Furthermore, the category tokens obtained by generative classification methods usually only represent the final decision and cannot reflect the model's learning degree for that category, semantic boundaries, or internal consistency. In practical applications, text of the same category may exhibit significant dispersion, semantic diversity, or form multiple internal subclusters in the latent space, and it is difficult to identify these learning abilities for those categories using tokens alone.
[0025] Furthermore, while traditional evaluation metrics such as Accuracy and F1 Score can measure the correctness of predictions, they cannot reveal high-dimensional features such as internal class structure, inter-class distribution relationships, and semantic overlap. Even if the prediction is correct, structural defects such as ambiguous class boundaries, overly loose intra-class distribution, large variance, or samples deviating from the class center will not be captured by the metrics, resulting in low accuracy in classification performance evaluation.
[0026] In summary, current technologies are insufficient to effectively evaluate the classification ability and learning stability of LLM for various types of text.
[0027] Therefore, embodiments of this disclosure provide an evaluation method for large language models classified using generative classification, which utilizes the hidden representations within the large language model to perform classification performance analysis, thereby achieving the classification performance evaluation of generative large language models.
[0028] Figure 1 An exemplary system architecture of an evaluation method and apparatus applicable to large language models according to embodiments of this disclosure is illustrated.
[0029] It is important to note that Figure 1 The examples shown are merely examples of system architectures that can be applied to embodiments of this disclosure, intended to help those skilled in the art understand the technical content of this disclosure. However, they do not imply that embodiments of this disclosure cannot be used in other devices, systems, environments, or scenarios. For example, in another embodiment, an exemplary system architecture for applying the large language model evaluation method and apparatus may include a terminal device. However, the terminal device may implement the large language model evaluation method and apparatus provided in the embodiments of this disclosure without interacting with a server.
[0030] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, and 103, a network 104, and a server 105. The network 104 serves as a medium for providing a communication link between the terminal devices 101, 102, and 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0031] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (for example only).
[0032] Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0033] Server 105 can be a server that provides various services, such as a backend management server that supports the content browsed by users using terminal devices 101, 102, and 103 (for example only). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0034] A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system. It solves the shortcomings of traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS"), such as high management difficulty and weak business scalability. A server can also be a server for a distributed system or a server that incorporates blockchain technology.
[0035] It should be noted that the large language model evaluation method provided in this embodiment can generally be executed by terminal devices 101, 102, or 103. Accordingly, the large language model evaluation device provided in this embodiment can also be located in terminal devices 101, 102, or 103.
[0036] Alternatively, the large language model evaluation method provided in this embodiment can generally be executed by server 105. Correspondingly, the large language model evaluation apparatus provided in this embodiment can generally be located in server 105. The large language model evaluation method provided in this embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Correspondingly, the large language model evaluation apparatus provided in this embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with terminal devices 101, 102, 103 and / or server 105. Alternatively, the large language model evaluation method provided in this embodiment can generally be executed by terminal devices 101, 102, or 103. Correspondingly, the large language model evaluation apparatus provided in this embodiment can generally be located in terminal devices 101, 102, or 103.
[0037] For example, a user can obtain or determine multiple sample texts with category labels by interacting with terminal devices 101, 102, and 103. Terminal devices 101, 102, and 103 send the obtained sample texts to server 105, which then calls a large language model to process the sample texts. For example, the large language model processes the multiple sample texts separately to obtain the category features of each sample text. The sample texts include instruction subtexts that guide the large language model to generatively output the category of the sample texts. The category features are mapped through the output layer of the large language model to obtain the category. Furthermore, based on the category labels of the multiple sample texts, the classification performance of the multiple category features is evaluated to obtain the evaluation result of the classification performance of the large language model. Afterwards, server 105 can send the evaluation result to terminal devices 101, 102, and 103 for display.
[0038] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0039] In the embodiments disclosed herein, the collection, storage, use, processing, transmission, provision, disclosure, and application of user personal information comply with relevant laws and regulations, necessary confidentiality measures have been taken, and they do not violate public order and good morals.
[0040] In the technical solution disclosed herein, the user's authorization or consent is obtained before acquiring or collecting the user's personal information.
[0041] Figure 2 A flowchart illustrating an evaluation method for a large language model according to an embodiment of this disclosure is shown schematically. Figure 2 As shown, the embodiment includes operations S210~S220.
[0042] In operation S210, a large language model is used to process multiple sample texts to obtain the category features of each sample text.
[0043] The large language model disclosed herein can be a large language model based on generative classification. For example, the large language model can be a decoder-only structure, an encoder-only structure without a classification head, or an encoder-decoder model without a classification head.
[0044] The sample text includes instruction subtext, which guides the large language model to generatively output the category of the sample text. For example, the instruction subtext may include a list of categories to instruct the large language model to generate categories within that list. Additionally, the sample text may include question subtext, which can serve as the text to be classified.
[0045] For example, the sample text could be: "You are a professional text classification expert and need to classify the following text into the specified categories. The category list is: {Category 1, Category 2, Category 3}. Please return the category names. The text to be classified is {Text to be classified}."
[0046] Categorical features are intermediate outputs of the large language model. After being mapped through the output layer of the large language model, the categorical features output the category in natural language form. Categorical features can indicate the category of the question subtext in the sample text from a high-dimensional semantic dimension. There is a unique mapping relationship between the category and the categorical feature.
[0047] In operation S220, the classification performance of multiple category features is evaluated based on the category labels of multiple sample texts, and the evaluation results of the classification performance for the large language model are obtained.
[0048] Multiple sample texts each have category labels, which serve as a criterion for evaluating the classification performance of the large language model. For example, the category labels can be categories from the category list of the aforementioned guiding subtexts.
[0049] If the category output by the large language model matches the category label, the model can be considered to have successfully classified the language. If the category output by the large language model differs from the category label, the model can be considered to have failed to classify the language. Although the category output by the large language model can determine whether classification was successful, it is difficult to measure the classification performance of the large language model. Therefore, the category label can be used as a classification benchmark, and the classification performance can be evaluated by assessing multiple category features to obtain an evaluation result of the classification performance of the large language model.
[0050] For example, category features can be processed into vector form, and the evaluation results for the classification performance of large language models can be determined by the distance distribution of vectors with the same or different category labels in the feature space.
[0051] In one embodiment, multiple sample texts may have one or more category labels. By analyzing the category features of sample texts with one category label, the classification performance of the large language model for the category corresponding to that category label can be obtained; similarly, by analyzing the category features of sample texts with multiple category labels, the classification performance of the large language model for each category and the classification performance among multiple categories can be obtained.
[0052] In the embodiments of this disclosure, by acquiring the category features of a large language model for sample text and analyzing the category features based on the category labels of the sample text, it is possible to determine whether the large language model has truly learned the internal semantic differences through high-dimensional semantics, and to provide quantifiable and interpretable category learning quality and performance through evaluation results.
[0053] In one specific embodiment, the sample text can be text that has undergone standardization. For example, the sample text can be pre-processed by word segmentation, noise reduction and encoding to obtain sample text with a consistent format.
[0054] In another specific embodiment, a Vectorized Large Language Model (vLLM) with an optimized inference framework can be used to process sample texts to improve the processing speed of category features. For example, the model parameters of a finely tuned large language model used for classification tasks can be loaded into the vLLM, and the vLLM can process multiple sample texts separately to obtain the category features of each sample text.
[0055] According to embodiments of this disclosure, classification performance is evaluated on multiple category features based on the category labels of multiple sample texts to obtain an evaluation result of the classification performance for a large language model. This includes: extracting features from multiple category features to obtain global category features corresponding to each category feature, wherein the multiple global category features have the same dimension; performing intra-class space analysis on multiple global category features with the same category label to obtain intra-class evaluation index values; and determining the evaluation result based on the intra-class evaluation index values.
[0056] Global category features are used to represent global information about category features. For example, global category features can represent global information about category features at the sentence level.
[0057] In one embodiment, feature extraction for category features can be one or more of mean pooling, max pooling, or global token (CLS token) feature extraction.
[0058] For example, global category features are ,in, Representation using a large language model for each i-th sample text Processed category features, The i-th global category feature is represented after pooling. The N global category features obtained from processing N sample texts constitute a set E. Each of the multiple global category features includes d dimensions.
[0059] Each sample text has its own category label, and there is a unique mapping relationship between the sample text and the global category feature. Therefore, the global category feature also has a category label.
[0060] By filtering multiple global category features with the same category label, multiple global category features belonging to the same category can be obtained. Then, the distance distribution between these multiple global category features is analyzed to obtain at least one intra-class evaluation index value.
[0061] The intra-class evaluation metric is the value of the intra-class evaluation metric. For example, the intra-class evaluation metric could be a metric used to measure the distance distribution of vectors in space.
[0062] In one embodiment, the evaluation result can be determined by comparing the intra-class evaluation metric value with the corresponding metric threshold. For example, the intra-class evaluation metric value is the distance between multiple global category features. If the distance between two global category features is less than the intra-class distance threshold, the representation large language model can learn the semantic overlap between the sample texts corresponding to the two global category features, and can perform good classification of inputs that are semantically similar to the sample texts corresponding to the two global category features. Therefore, when the distance between two global category features is less than the intra-class distance threshold, the representation large language model is evaluated as having good classification performance for the category corresponding to the category label.
[0063] In the embodiments of this disclosure, feature extraction of category features ensures the generation of stable and comparable global category features, facilitating accurate spatial analysis later. By performing intra-class spatial analysis on global category features with the same category label, intra-class evaluation index values are obtained, enabling the determination of whether the large language model has correctly learned the semantic structure within the category, and quantifying the learning effect and classification performance of the large language model on each category.
[0064] Figure 3 The illustration schematically depicts a scenario where evaluation results are determined through intra-class space analysis according to an embodiment of this disclosure. For example... Figure 3As shown, for each sample text, after the sample text 310 is input into the large language model M1, the large language model M1, guided by the sub-texts within the sample text 310, performs a category generation task on the question sub-texts within the sample text 310, obtaining category features 340. These category features 340 are then mapped through the output layer M110 within the large language model M1 to output categories 320 in natural language form. To evaluate the large language model M1, the category features 340 can be pooled to obtain global category features 350. Intra-class spatial evaluation is then performed on the global category features with the same category label, combined with the category label 330 of the sample text 310, to obtain intra-class evaluation index values 360. The evaluation result 370 can be determined by comparing the intra-class evaluation index value 360 with the corresponding index threshold.
[0065] In real-world scenarios, text of the same category may exhibit multiple semantic structures. For example, in a financial risk control scenario, the transaction risk category could contain subtext indicating security risks for both parties in the transaction, or it could contain subtext indicating security risks associated with the transaction method. Similarly, in a content moderation scenario, the violation category could contain subtext indicating the risk of false advertising, or it could contain subtext indicating the risk of product violations. In these scenarios, sample text of the same category can have multiple semantic structures. Even if the large language model outputs the correct category, it's difficult to determine from the output whether the model has successfully learned different semantics within the same category, or whether it has mistakenly identified text with one semantic meaning as text with another, while generating the correct category.
[0066] Therefore, multi-semantic structures can be evaluated using in-class evaluation index values.
[0067] According to embodiments of this disclosure, the intra-class evaluation index value includes a structural index value used to evaluate whether there is a multi-semantic structure within the class; intra-class spatial analysis is performed on multiple global category features with the same category label to obtain the intra-class evaluation index value, including: clustering multiple global category features with the same category label to obtain at least one intra-class sub-cluster; when the number of intra-class sub-clusters is greater than a number threshold, the sub-cluster distance between multiple intra-class sub-clusters is determined; wherein, the structural index value includes at least one of the number of intra-class sub-clusters and the sub-cluster distance.
[0068] Intra-class subclusters refer to a set of multiple global category features that have the same semantic structure within the category corresponding to the same category label.
[0069] Figure 4A A scene diagram illustrating multiple intra-class subclusters according to embodiments of the present disclosure is shown schematically. For example... Figure 4AAs shown, after clustering multiple global category features with the same category label 410, four intra-category sub-clusters 411 are obtained. The global category features of multiple intra-category sub-clusters have different semantic structures in space, while multiple global category features within the intra-category sub-clusters have the same semantic structure in space.
[0070] For example, in financial risk control scenarios, transaction risk categories can be clustered to obtain two intra-class subclusters, representing security risks for both parties in the transaction and security risks associated with the transaction method, respectively. Similarly, in content moderation scenarios, violation categories can be clustered to obtain two intra-class subclusters, representing risks of false advertising and product violations, respectively.
[0071] For example, semantic similarity-based clustering can be used to cluster multiple global category features with the same category label to obtain at least one intra-cluster. Semantic similarity-based clustering methods include at least one of the following: density-based spatial clustering of applications with noise (DBSCAN), hierarchical clustering (Agglomerative Nesting), etc.
[0072] Subcluster distance is used to evaluate the semantic differences between multiple intra-class subclusters by distance. If the number of intra-class subclusters is greater than a threshold, it indicates the existence of multiple semantic structures within the class, and the subcluster distance between multiple intra-class subclusters can be further determined; otherwise, it indicates the absence of multiple semantic structures within the class. For example, the threshold can be a positive integer greater than or equal to 2.
[0073] In one embodiment, if the number of type subclusters is greater than a quantity threshold, the structural index value includes the number of intra-class subclusters and the subcluster distance, or only the subcluster distance. If the number is less than the quantity threshold, the structural index value may only include the number of intra-class subclusters.
[0074] In the embodiments of this disclosure, at least one intra-class sub-cluster is obtained by clustering multiple global category features with the same category label. The number of intra-class sub-clusters can quantify whether the class includes multiple semantic structures. When the number of intra-class sub-clusters is greater than a threshold, the sub-cluster distance between multiple intra-class sub-clusters is determined. In the presence of multiple semantic structures, the semantic differences between multiple semantic structures can be further quantified. Thus, the embodiments of this disclosure can provide quantifiable and interpretable evaluation results of category learning quality and classification performance through structural index values.
[0075] In one embodiment, the subcluster distance between two intra-class subclusters can include the minimum distance between two global categorical features from the two intra-class subclusters. The minimum distance allows for the quantification of semantic differences between multiple semantic structures from the boundary semantic dimension of the intra-class subclusters.
[0076] In another embodiment, determining the subcluster distance between multiple intra-class subclusters includes: determining the first class center of each of the multiple intra-class subclusters based on multiple global class features belonging to the same intra-class subcluster; and determining the distance between the multiple first class centers as the subcluster distance between the multiple intra-class subclusters.
[0077] For subclusters within the same class, the class mean of multiple global categorical features within that subcluster can be used as the first class center of the subcluster. The first class center can measure the overall semantic features of the subcluster. By using the distance between the first class centers as the subcluster distance, the overall semantic difference between multiple semantic structures can be quantified from the overall semantic dimension of the subcluster.
[0078] For example, the first type of center can be determined by the following formula (1):
[0079] (1)
[0080] in, Characterizes the global category features belonging to category sub-cluster A. Quantity, The first class center characterizing the sub-cluster A within the class.
[0081] For example, if the structural index value includes sub-cluster distance, and the sub-cluster distance is greater than or equal to the inter-cluster distance threshold, the evaluation result indicates that the classification performance of the category corresponding to the category label is good. In this case, for sample texts with multiple semantic structures in the same category, the large language model has good classification performance. The large language model can successfully learn different semantics of the same category and generate the same category according to the true semantics of different sample texts.
[0082] In the embodiments of this disclosure, by determining the distance between multiple first-class centers as the sub-cluster distance between multiple intra-class sub-clusters, the overall semantic difference between multiple semantic structures can be quantified from the overall semantic dimension of intra-class sub-clusters, thereby quantifying and evaluating the overall semantic difference between multiple semantic structures of the same category and quantifying and evaluating the classification ability of the large language model for sample texts with multiple semantic structures in the same category.
[0083] In one specific embodiment, where the intra-class evaluation metrics include structural evaluation metrics, or where the intra-class evaluation metric values include structural evaluation metric values, the intra-class evaluation metric values can also be used as the standard for data cleaning or labeling. For example, intra-class evaluation metric values can be used as the standard data cleaning for classification scenarios such as content moderation and financial risk control, in order to further improve the ability of the large language model to distinguish between risky text and normal text, improve the classification ability of complex distributed text (such as text with multiple semantic structures), and improve classification accuracy and stability.
[0084] According to embodiments of this disclosure, the structural index value further includes: an anomaly profile coefficient for evaluating whether a global category feature is misclassified; the method further includes: determining an anomaly feature from a plurality of global category features having a first category label, wherein the anomaly feature is: a global category feature whose distance to the first category center of each of the plurality of intra-category sub-clusters having the first category label is greater than a distance threshold; and determining the anomaly profile coefficient based on the distance between the anomaly feature and the plurality of global category features having the first category label, and the distance between the anomaly feature and the plurality of global category features having a second category label, wherein the second category label is different from the first category label.
[0085] Anomaly features represent features whose semantic structures differ from those of multiple intra-class subclusters. For categories with multiple semantic structures, such as the category corresponding to the first category label, after intra-class clustering, global category features that are all more than a distance threshold from the first class center of each of the multiple intra-class subclusters can be selected from the category and regarded as outlier anomaly features.
[0086] Through intra-class analysis, although the semantic structure of the anomalous feature differs from each intra-class sub-cluster within the category corresponding to the first category label, it is difficult to distinguish whether the anomalous feature is caused by noise or a labeling error. For example, if the anomalous feature is caused by a labeling error, its semantic structure may be similar to the semantic structure of its category; if the anomalous feature is noise, its semantic structure will not be similar to the semantic structure of its category.
[0087] Therefore, the abnormal silhouette coefficient can be used to further distinguish whether global category features are misclassified.
[0088] In one embodiment, the overall semantic difference between the anomalous feature and the category corresponding to the first category label can be determined by the distance between the anomalous feature and multiple global category features with a first category label; the overall semantic difference between the anomalous feature and the category corresponding to the second category label can be determined by the distance between the anomalous feature and multiple global category features with a second category label. The anomalous silhouette coefficient can be determined by the overall semantic differences between the anomalous feature and the two categories respectively.
[0089] In the embodiments of this disclosure, for global category features whose distances to the first category centers of multiple intra-category sub-clusters with first category labels are all greater than a distance threshold, the classification performance of the large language model for the multi-semantic structure of the first category label is further quantitatively determined by the distance between the abnormal feature and global category features of the same and different categories.
[0090] According to embodiments of this disclosure, determining an anomaly profile coefficient based on the distance between an anomaly feature and a plurality of global category features having a first category label, and the distance between an anomaly feature and a plurality of global category features having a second category label, includes: determining a first average distance based on the distance between the anomaly feature and the plurality of global category features having a first category label; determining a second average distance based on the distance between the anomaly feature and the plurality of global category features having a second category label; and determining an anomaly profile coefficient based on the difference between the second average distance and the first average distance.
[0091] The second category label differs from the first category label; the second category label can be any label different from the first category label.
[0092] For example, the summation of distances between anomaly features and multiple global category features with a first category label yields a first difference value; the average of these first difference values yields a first average distance, which characterizes the overall semantic difference between the anomaly feature and the category with the first category label. Similarly, the summation of distances between anomaly features and multiple global category features with a second category label yields a second difference value; the average of these second difference values yields a second average value, which characterizes the overall semantic difference between the anomaly feature and the category with the second category label.
[0093] For example, the anomaly contour coefficient can be the difference between the overall semantic difference between the anomaly feature and the category corresponding to the second category label and the overall semantic difference between the category corresponding to the first category label. If the difference is greater than the difference threshold, it indicates that the semantic structure of the anomaly feature is closer to the second category label, and the anomaly feature is caused by mislabeling; otherwise, the anomaly feature is noise.
[0094] Alternatively, the larger of the second and first average distances can be determined, and the ratio of the difference between the second and first average distances to the larger average distance can be used as the silhouette score.
[0095] For example, the abnormal contour coefficient S i It can be determined by the following formula (2):
[0096] (2)
[0097] Among them, ai The first average distance, b, represents the anomalous feature. i The second average distance is used to characterize the anomalous features.
[0098] For the abnormal contour coefficient determined by the above formula (2), if the absolute value of the abnormal contour coefficient is greater than the contour threshold and the larger average distance is the first average distance, then the abnormal feature has a large degree of separation from the category corresponding to the second category label and the category corresponding to the first category label, and the semantic structure is closer to the category corresponding to the second category label. In this case, the abnormal feature is caused by incorrect labeling. If the absolute value of the abnormal contour coefficient is greater than the contour threshold and the larger average distance is the second average distance, then the abnormal feature has a large degree of separation from the category corresponding to the second category label and the category corresponding to the first category label, and the semantic structure is closer to the category corresponding to the first category label. There is no classification error caused by labeling error. Therefore, the abnormal feature is noise. In other cases, the abnormal feature can be treated as noise.
[0099] If the anomalous feature is due to labeling errors, the representation large language model has learned the semantic structure corresponding to the anomalous feature, and the category label corresponding to that anomalous feature can be updated. In this case, the evaluation result determined based on the intra-class evaluation label value indicates good classification performance for the category corresponding to that category label. If the anomalous feature is noise, the representation large language model has not yet learned the semantic structure of the sample text corresponding to the anomalous feature, making it difficult to classify that anomalous feature. The evaluation result determined based on the intra-class evaluation label value indicates poor classification performance for the sample text corresponding to the anomalous feature under that category label.
[0100] In the embodiments of this disclosure, by determining the first average distance and the second average distance between abnormal features and global category features of the same and different classes, as well as the difference between the first average distance and the second average distance, the classification performance of the large language model for the multi-semantic structure of the first category label can be quantitatively determined, especially the classification performance for the semantic structure corresponding to the abnormal features.
[0101] Figure 4B The illustration schematically depicts a scenario diagram with a multi-semantic structure containing anomalous features within a category according to embodiments of the present disclosure. For example... Figure 4B As shown, multiple global category features with the first category label 420 are clustered to obtain multiple intra-category sub-clusters. Simultaneously, an anomaly feature 421 exists after clustering. The category corresponding to the second category label 430 is the nearest neighbor category of the category corresponding to the first category label 420. At this point, the first and second average distances are determined by quantization, and the anomaly contour coefficient is determined based on the difference between the second and first average distances. Since the anomaly contour coefficient quantizes the anomaly feature 421 as a classification operation caused by the annotation operation, the classification performance of the large language model is relatively good.
[0102] According to embodiments of this disclosure, the second category label is determined in the following manner: the inter-class distance between the multiple category labels is determined based on the second category centers corresponding to the multiple category labels respectively, wherein the second category centers are determined using multiple global category features with the same category label; and the second category label with the smallest distance to the first category label is determined based on the inter-class distance between the multiple category labels.
[0103] The category corresponding to the second category label can be the nearest neighbor category to the category corresponding to the first category label.
[0104] For multiple global category features with the same category label, the class mean of the multiple global category features corresponding to that category label can be used as the second category center for that category label. The second category center can measure the overall semantic features of the category.
[0105] For example, the second type of center can be determined by the following formula (3):
[0106] (3)
[0107] in, The representation represents the global category feature with category label c. Quantity, The second class center represents the category label c.
[0108] After determining the second-class centers, the distance between multiple second-class centers can be used as the inter-class distance between multiple class labels to measure the distance between different categories from the perspective of overall semantic features. Then, the class label with the smallest distance to the first class label is taken as the second-class label.
[0109] For example, the inter-class distance between category label c1 and category label c2 It can be determined by the following formula (4):
[0110] (4)
[0111] in, and The second class centers, representing class labels c1 and c2 respectively, Representing the L2 paradigm.
[0112] In the embodiments of this disclosure, the nearest neighbor category label (second category label) of the first category label with multiple semantic structures is determined by the overall semantic similarity between categories represented by the inter-class distance. This can first filter out the second category label that is most semantically similar to the first category label, thereby improving the evaluation accuracy of the anomaly contour coefficient and thus improving the classification performance evaluation accuracy of the large language model for the multiple semantic structures of the first category label, especially for the classification performance evaluation accuracy of the semantic structures corresponding to the anomaly features.
[0113] According to embodiments of this disclosure, the intra-class evaluation index value includes intra-class variance and intra-class average distance for evaluating intra-class spatial distribution; intra-class spatial analysis is performed on multiple global category features with the same category label to obtain intra-class evaluation index values, including: determining a second class center for multiple global category features with the same category label; and determining the intra-class variance and intra-class average distance based on the distances between the multiple global category features with the same category label and the second class center respectively.
[0114] The method for determining the second type of center can be found above and will not be repeated here.
[0115] For multiple global class features with the same class label, the intra-class variance can be determined based on the distance between each global class feature and the second class center. For example, the intra-class variance can be calculated as the ratio of the sum of the squared distances between each global class feature and the second class center to the number of global class features.
[0116] For example, the within-class variance can be determined by the following formula (5):
[0117] (5)
[0118] in, The intraclass variance of the category label c is used to characterize the other parameters. For the definition of formula (3) above, please refer to the definition of formula (3) above.
[0119] In another embodiment, the ratio of the sum of distances between each global class feature and the second class center to the number of global class features is used as the intra-class distance. For example, the intra-class distance can be determined by the following formula (6):
[0120] (6)
[0121] in, The average intra-class distance of category label c.
[0122] According to embodiments of this disclosure, a smaller intra-class variance indicates higher consistency within the class, and a smaller intra-class mean distance indicates semantic compactness within the class. Therefore, when the intra-class evaluation metrics include intra-class variance and intra-class mean distance, and when each metric value is less than its corresponding threshold, the evaluation result determined based on the intra-class evaluation label value indicates good classification performance for the sample text corresponding to that class label.
[0123] In embodiments of this disclosure, the compactness of the large language model for intra-class semantic understanding is quantified by intra-class variance and intra-class average distance used to evaluate intra-class spatial distribution, thereby quantitatively determining the classification performance of the large language model for the category label, thus improving the interpretability and reliability of classification performance evaluation.
[0124] In another embodiment, the intra-class evaluation metric may further include an intra-class silhouette coefficient. For multiple global category features with the same label, similar to the method for determining anomaly silhouette coefficients, the silhouette coefficient of each global category feature is determined, and the average of the silhouette coefficients of multiple global category features is used as the intra-class silhouette coefficient for that category.
[0125] For example, taking the first category label as an example, for each global category feature of the first category label, the silhouette coefficient of each global category feature of the first category label is determined according to formula (2). Then, the ratio of the sum of the silhouette coefficients of each global category feature of the first category label to the number of global category features within the first category label is determined as the intra-class silhouette coefficient. The closer the intra-class silhouette coefficient is to 1, the higher the separation degree between the first category label and the nearest class. The evaluation result determined based on the intra-class evaluation index value indicates that the large language model has better classification performance for the category corresponding to the first category label.
[0126] According to embodiments of this disclosure, the method further includes: performing inter-class spatial analysis on multiple global category features with different category labels to obtain inter-class evaluation index values; and determining the evaluation result based on the inter-class evaluation index values.
[0127] Multiple sample texts can have different category labels. Inter-class spatial analysis can be performed on multiple global category features with different category labels to obtain inter-class evaluation index values.
[0128] In one embodiment, for each category, intra-class spatial analysis can be performed on the global category features of each category to obtain the intra-class evaluation index value for each category. The inter-class evaluation index value is determined by combining the intra-class evaluation index values for each category. For example, the number of categories that meet the corresponding index threshold of the intra-class evaluation index value, or the difference between the intra-class evaluation index value and the corresponding index threshold, can be used as the inter-class evaluation index value. The evaluation result is determined based on the comparison between the inter-class evaluation index value and the corresponding index threshold.
[0129] In another embodiment, inter-class analysis can be performed using indicators other than intra-class evaluation index values to obtain inter-class evaluation index values; the evaluation result is determined based on the comparison results between the inter-class evaluation index values and the corresponding index thresholds.
[0130] In the embodiments of this disclosure, by performing inter-class spatial analysis on global category features with different category labels, inter-class evaluation index values are obtained, which can determine whether the large language model has correctly learned the semantic structure of each category and whether it has correctly distinguished the semantic differences between categories, thereby quantitatively determining the learning effect and classification performance of the large language model between categories.
[0131] According to embodiments of this disclosure, the inter-class evaluation index value includes a global inter-class separation degree used to evaluate inter-class differences; inter-class spatial analysis is performed on multiple global category features with different category labels to obtain the inter-class evaluation index value, including: determining the inter-class distance between multiple category labels based on the second category centers corresponding to the multiple category labels respectively; and determining the global inter-class separation degree based on the inter-class distance between the multiple category labels and the intra-class variance of the multiple category labels.
[0132] For each category label with multiple global category features, the second class center, inter-class distance, and intra-class variance can be determined using the method described above, which will not be repeated here.
[0133] In one embodiment, the sum of squared inter-class distances among multiple category labels is used to evaluate the semantic differences among multiple categories globally, while the intra-class variance is used to evaluate the distribution of semantic differences within each class. The sum of intra-class variances is used to evaluate the distribution of intra-class semantic differences across all categories. The ratio of the sum of squared inter-class distances among multiple category labels to the sum of intra-class variances of multiple category labels is defined as the global inter-class separation ratio (Fisher Ratio). This ratio determines the strength of the large language model's ability to capture inter-class semantic differences relative to the distribution of intra-class semantic differences, thereby enabling the evaluation of inter-class differences.
[0134] For example, the global inter-class separation degree can be determined by the following formula (7):
[0135] (7)
[0136] in, Characterizes the global inter-class separation degree. The sum of squared distances between different category labels. It is the sum of the intra-class variances of the C category labels.
[0137] For example, if the inter-class evaluation metric includes global inter-class separation, a large language model can learn the semantic structure of multiple categories better when the global inter-class separation is greater than the corresponding separation threshold. This amplifies the semantic differences between classes and suppresses internal noise, resulting in better classification performance. Therefore, the evaluation results determined based on the inter-class evaluation metric indicate that the large language model has good classification performance.
[0138] In the embodiments of this disclosure, by evaluating the inter-class distance of semantic differences between categories and the intra-class variance of semantic differences within categories, the ability of a large language model to distinguish the semantics corresponding to multiple category labels can be quantitatively evaluated from a global perspective of all category labels through the global inter-class separation degree, providing quantifiable and interpretable evaluation results of category learning quality and classification performance.
[0139] According to embodiments of this disclosure, the inter-class evaluation index value includes a confusion index value for evaluating the degree of inter-class confusion. The inter-class evaluation index value is obtained by performing inter-class spatial analysis on multiple global category features with different category labels, including: determining multiple nearest neighbor features for each of the multiple global category features based on the distance between them; determining the number of features with category labels different from the global category feature among the multiple nearest neighbor features for each global category feature; and determining a confusion index value for a third category label based on the number of features of each of the multiple global category features with a third category label and the number of global category features with a third category label.
[0140] For example, for multiple global category features corresponding to multiple sample texts, without distinguishing category labels, the distance between two global category features is calculated. Only from the dimension of spatial distance distribution, multiple nearest neighbor features that satisfy the nearest neighbor distance condition with each global category feature are determined. The nearest neighbor distance condition can be a nearest neighbor threshold determined according to actual needs. The nearest neighbor feature can be a global category feature whose distance to the current (e.g., the i-th) global category feature is less than the nearest neighbor threshold.
[0141] It is understandable that classification errors are more likely to occur between two global category features that are closer in distance. Therefore, the degree of inter-class confusion can be determined by the probability that multiple neighboring features belong to different categories from the current global category feature.
[0142] Since the sample text has category labels, the category labels of the sample text can be used as a benchmark for classification performance. Therefore, the number of features with category labels different from the global category feature can be determined by the category labels of each global category feature and its multiple nearest neighbor features.
[0143] The third category label can be any category label possessed by multiple sample texts. For multiple global category features with a third category label, the confusion index value is determined by the ratio of the sum of the feature counts of each of the multiple global category features (referring to the number of neighboring features of category labels different from the global category feature in the preceding text) to the number of global category features of the third category label.
[0144] For example, the confusion index value can be determined by the following formula (8):
[0145] (8)
[0146] in, The confusion index value representing category label c, This indicates that among the nearest neighbors of the i-th global category feature in category label c, none belong to the category corresponding to category label c. Quantity, This indicates the category corresponding to category label c. The number of global category features.
[0147] Figure 5 The illustration schematically depicts a scenario diagram for determining a confusion index value according to an embodiment of the present disclosure. Multiple global category features with three category labels have spatially similar characteristics. Figure 5 The distribution is shown below. Taking the three category labels "refund," "logistics," and "after-sales" in the e-commerce field as examples, for the global category feature 520 with the "after-sales" category label, there are 7 nearest neighbor features within the nearest neighbor threshold 510: 4 nearest neighbor features with the same category label as global category feature 520, and 3 nearest neighbor features with different category labels. For the global category feature 530 with the "after-sales" category label, there is 1 nearest neighbor feature within the nearest neighbor threshold 510, and it has the same category label. There are a total of 8 global category features with "after-sales," so the confusion index value for "after-sales" = (3 + 0 + ...) / 8.
[0148] In the embodiments of this disclosure, for each global category feature of the third category label, the probability of classification confusion between categories is quantified by the sum of the probabilities of multiple nearest neighbor features and the current global category feature belonging to different categories. This quantifies the ability of the large language model to distinguish the semantics corresponding to multiple category labels, providing quantifiable and interpretable evaluation results of category learning quality and classification performance.
[0149] According to embodiments of this disclosure, the inter-class evaluation index value includes a semantic overlap index value used to evaluate the degree of semantic overlap between classes; inter-class spatial analysis is performed on multiple global category features with different category labels to obtain the inter-class evaluation index value, including: determining the semantic overlap index value between the categories corresponding to the multiple category labels based on the second category centers corresponding to the multiple category labels respectively.
[0150] The semantic overlap index between corresponding categories of multiple category labels can be determined by assessing the similarity between the second-category centers of multiple category labels. For example, the cosine similarity between the second-category centers can be used as the semantic overlap index.
[0151] For example, the semantic overlap index value can be determined by the following formula (9):
[0152] (9)
[0153] in, The second class center representing the c1 class label The second center of the c2 category label dot product, Indicates L2 normal form, The index value represents semantic overlap.
[0154] According to embodiments of this disclosure, when the inter-class evaluation index value includes the semantic overlap index value, if the semantic overlap index value is less than the overlap threshold, it indicates that the higher the degree of semantic overlap between classes, the worse the learning degree of the semantic results of the large language model for the two category labels with a higher degree of semantic overlap. Therefore, the evaluation result determined based on the inter-class evaluation index value indicates that the classification performance of the large language model for the two category labels with a higher degree of semantic overlap is poor.
[0155] In the embodiments of this disclosure, the second type center can characterize the overall semantic features of multiple category labels. By determining the semantic overlap index value between the second type centers of multiple category labels, the degree of semantic overlap between multiple category labels can be evaluated as a whole, thereby quantitatively evaluating the learning ability of the large language model for the semantics corresponding to multiple category labels, and providing quantifiable and interpretable category learning quality and classification performance evaluation results.
[0156] According to embodiments of this disclosure, the method further includes: determining the evaluation result based on the intra-class evaluation index value and the inter-class evaluation index value.
[0157] For some data with complex distributions, it is difficult to evaluate the classification performance of a large language model using a single intra-class or inter-class evaluation metric. Alternatively, for scenarios such as model version upgrades or model migrations, a single intra-class or inter-class evaluation metric is insufficient to comprehensively evaluate the classification performance of a large language model. Therefore, it is advisable to combine intra-class and inter-class evaluation metrics.
[0158] In one embodiment, the evaluation result can be determined based on the comparison results between the above-mentioned intra-class evaluation index values, inter-class evaluation index values and their respective index thresholds.
[0159] For example, if a category label corresponds to a category with multiple semantic structures, the abnormal contour coefficient for the abnormal feature represents the abnormal feature as noise; at the same time, the confusion index value between the category label corresponding to the abnormal feature and other categories indicates that the large language model is not easily confused with other categories for this category. The evaluation result determined based on the intra-class index value and the inter-class index value indicates that the large language model has good overall classification performance, but poor classification performance for a single abnormal feature.
[0160] In the embodiments of this disclosure, by combining intra-class evaluation metrics and inter-class evaluation metrics, the classification performance of a large language model can be quantified in a balanced manner within and between classes, and quantifiable and interpretable evaluation results of category learning quality and classification performance can be provided.
[0161] Figure 6 The illustration schematically depicts a scenario where evaluation results are determined through intra-class space analysis according to an embodiment of this disclosure. For example... Figure 6 As shown, for each sample text, after the sample text 610 is input into the large language model M1, the large language model M1, guided by the sub-texts within the sample text 610, performs a category generation task on the question sub-texts within the sample text 610, obtaining category features 640. These category features 640 are then mapped by the output layer M110 within the large language model M1, outputting a category in natural language form, 620. To implement the large language model M1, the category features 640 can be pooled to obtain global category features 650. Combining the category labels 630 of the sample text 610, intra-class and inter-class spatial evaluations are performed on the global category features with the same category labels, resulting in intra-class evaluation index values 660 and inter-class evaluation index values 680. By comparing the intra-class and inter-class evaluation index values 660 with their respective corresponding index thresholds, the evaluation result 670 can be determined.
[0162] According to embodiments of this disclosure, the above-mentioned intra-class evaluation index values and inter-class evaluation index values can also be summarized into a comprehensive classification quality report, and the index values can be visualized. For example, the visualization forms include heatmaps, scatter plots, radar charts, or index tables, so as to intuitively display the learning effect, classification performance, difficult-to-classify categories, and potential problems of the large language model for each category.
[0163] In another embodiment, the evaluation results determined based on the intra-class evaluation index values and inter-class evaluation index values can also provide quantitative guidance for data optimization or model optimization in various scenarios.
[0164] For example, in search and recommendation scenarios as well as data labeling scenarios, the inter-class evaluation metrics (such as semantic overlap metrics) can be used to determine whether a large language model has good or poor classification performance for certain categories. In this case, categories with poor classification performance can be labeled as anomalous categories. Then, by using intra-class and inter-class evaluation metrics, a better recall path can be determined, data labels can be optimized, and the model's ability to adapt to classification on diverse data can be improved.
[0165] For example, in model upgrades, A / B testing, and production environment testing, multiple sample texts are input into different versions of the large language model. Based on the intra-class and inter-class evaluation metrics of each version, model degradation or semantic drift issues in different versions can be identified to assist in adjusting the large language model. Furthermore, for newly added sample texts, after determining the intra-class and inter-class evaluation metrics using the category features obtained from the large language model, the distribution of the sample text within and between classes can be determined. Sample texts with overly concentrated or abnormal distributions can be processed to prevent overfitting during training or fine-tuning, ensuring the model's stability and generalization ability in incremental environments.
[0166] For example, in intelligent customer service and automatic question answering scenarios, based on the intra-class evaluation index values (such as structural index values) and inter-class evaluation index values (such as global inter-class separation degree and semantic overlap index) of each version, the large language model can be used to determine whether certain categories are defined too broadly (determined by structural index values) or have high semantic overlap (determined by global inter-class separation degree and semantic overlap index). This provides a basis for intent optimization and enhances the large language model's ability to classify complex and diverse user query data.
[0167] In one embodiment, determining the evaluation result based on the intra-class evaluation index value and the inter-class evaluation index value includes: determining the target evaluation result when the intra-class evaluation index for the category corresponding to the fourth category label meets the abnormal condition and the inter-class evaluation index meets the normal condition, wherein the target evaluation result is used to characterize the multiple evaluations of the category corresponding to the fourth category label.
[0168] An outlier could be that the intra-class evaluation metrics of the fourth category label exhibit multiple semantic structures with relatively small semantic differences. For example, an outlier could be that the category corresponding to the fourth category label includes multiple intra-class sub-clusters, and the distance between the sub-clusters is less than the inter-cluster distance threshold.
[0169] Normal conditions can be: the confusion index value of the fourth category label indicates that the large language model is not easily confused with other categories for this category, and / or the global inter-class separation degree is greater than the corresponding separation degree threshold, indicating that the large language model can learn the semantic structure of multiple categories well.
[0170] When the intra-class evaluation metrics for the fourth category label meet the abnormal conditions and the inter-class evaluation metrics meet the normal conditions, the large language model performs well in classifying the semantic structure of each category, but performs poorly in classifying the semantic structure of categories with multiple semantic structures. Therefore, the classification performance of the large language model for the fourth category label with a single intra-class structure can be confirmed by optimizing the sample text with the fourth category label and evaluating the sample text with the fourth category label multiple times.
[0171] In the embodiments of this disclosure, by combining intra-class evaluation index values and inter-class evaluation index values, the classification performance within and between classes can be quantified, and the classification performance of the large language model for a specific category label can also be quantified using intra-class and inter-class evaluation index values, providing interpretable performance evaluation results.
[0172] According to embodiments of this disclosure, the method further includes: performing sample augmentation on multiple sample texts with a fourth category label based on an intra-class evaluation index to obtain multiple augmented sample texts; processing the multiple augmented sample texts separately using a large language model to obtain the category features of each of the multiple augmented sample texts; performing intra-class spatial analysis on the category features of each of the multiple augmented sample texts to obtain updated intra-class evaluation index values; and determining the evaluation result of the large language model for the category corresponding to the fourth category label based on the updated intra-class evaluation index values.
[0173] The poor classification performance of large language models for multi-semantic structures with a fourth category may be due to the unclear definition of multi-semantic structures within a class.
[0174] For example, the problem subtext of the sample text might be "Shocking! This health supplement can kill cancer cells, and everyone is secretly recommending it. This health supplement is produced by XXX company and is safe and reliable." The fourth category label for this sample text could be "violation," but because "Shocking! This health supplement can kill cancer cells, and everyone is secretly recommending it" and "This health supplement is produced by XXX company and is safe and reliable" respectively involve the risks of false advertising and product violations within the violation category, this sample text is a complex sample text containing multiple semantic structures. The poor classification performance of multiple semantic structures may be due to the unclear definition of the two semantic structures mentioned above, leading to confusion between the two semantic structures.
[0175] In one embodiment, the definition subtext of the fourth category label can be added to the sample text to obtain the enhanced sample text. Similar to the above method, the enhanced sample text is processed using a large language model to obtain the corresponding category features, and updated intra-class evaluation index values are obtained by performing intra-class space analysis on the category features.
[0176] If the updated intra-class evaluation index value still meets the outlier condition, the evaluation result indicates that the large language model has poor classification performance for the category corresponding to the fourth category label.
[0177] In the embodiments of this disclosure, by enhancing the samples and then determining whether the intra-class evaluation index value meets the abnormal conditions, the classification performance of a specific category of the large language model can be quantitatively, accurately, and interpretably determined through a secondary evaluation.
[0178] Figure 7 A block diagram of an evaluation apparatus for a large language model according to an embodiment of the present disclosure is shown schematically. Figure 7 As shown, the evaluation device 700 for large language models includes a feature acquisition module 710 and an evaluation module 720.
[0179] The feature acquisition module 710 is used to process multiple sample texts separately using a large language model to obtain the category features of each sample text. The sample texts include instruction subtexts, which guide the large language model to generatively output the categories of the sample texts. The category features are mapped through the output layer of the large language model to obtain the categories.
[0180] Evaluation module 720 is used to evaluate the classification performance of multiple category features based on the category labels of multiple sample texts, and obtain the evaluation results of the classification performance for the large language model.
[0181] According to an embodiment of this disclosure, the evaluation module 720 includes: a feature extraction submodule, used to extract features from multiple category features respectively to obtain global category features corresponding to each of the multiple category features, wherein the multiple global category features have the same dimension; an intra-class analysis submodule, used to perform intra-class spatial analysis on multiple global category features with the same category label to obtain intra-class evaluation index values; and a first evaluation submodule, used to determine the evaluation result based on the intra-class evaluation index values.
[0182] According to embodiments of this disclosure, the intra-class evaluation metric values include structural metric values used to evaluate whether multiple semantic structures exist within the class. The intra-class analysis submodule includes:
[0183] The clustering unit is used to cluster multiple global category features with the same category label to obtain at least one intra-cluster; the first index determination unit is used to determine the sub-cluster distance between multiple intra-clusters when the number of intra-clusters is greater than a number threshold; wherein, the structural index value includes at least one of the number of intra-clusters and the sub-cluster distance.
[0184] According to embodiments of this disclosure, the first index determination unit includes: a first determination subunit, configured to determine the first class center of each of the multiple intra-class subclusters based on multiple global category features belonging to the same intra-class subclusters; and a second determination subunit, configured to determine the distance between the multiple first class centers as the subcluster distance between the multiple intra-class subclusters.
[0185] According to embodiments of this disclosure, the structural index value further includes: an anomaly profile coefficient for evaluating whether a global category feature is misclassified; the intra-class analysis submodule further includes: a second index determination unit for determining anomaly features from a plurality of global category features having a first category label, wherein the anomaly features are: global category features whose distances to the first class centers of the plurality of intra-class subclusters having the first category label are all greater than a distance threshold; and a third index determination unit for determining anomaly profile coefficients based on the distances between the anomaly features and the plurality of global category features having the first category label, and the distances between the anomaly features and the plurality of global category features having a second category label, wherein the second category label is different from the first category label.
[0186] According to an embodiment of this disclosure, the third indicator determination unit includes: a third determination subunit, configured to determine a first average distance based on the distance between the abnormal feature and a plurality of global category features having a first category label; a fourth determination subunit, configured to determine a second average distance based on the distance between the abnormal feature and a plurality of global category features having a second category label; and a fifth determination subunit, configured to determine an abnormal contour coefficient based on the difference between the second average distance and the first average distance.
[0187] According to an embodiment of this disclosure, the intra-class analysis submodule further includes: a fourth indicator determination unit, configured to determine the inter-class distance between multiple category labels based on the second category centers corresponding to the multiple category labels respectively, wherein the second category centers are determined using multiple global category features with the same category label; and a fifth indicator determination unit, configured to determine the second category label with the smallest distance to the first category label based on the inter-class distance between the multiple category labels.
[0188] According to embodiments of this disclosure, the intra-class evaluation index values include intra-class variance and intra-class average distance for evaluating intra-class spatial distribution; the intra-class analysis submodule includes: a sixth index determination unit for determining the second class center of multiple global class features with the same class label; and a seventh index determination unit for determining the intra-class variance and intra-class average distance based on the distances between the multiple global class features with the same class label and the second class center.
[0189] According to an embodiment of this disclosure, the evaluation module 720 further includes: an inter-class analysis submodule, used to perform inter-class spatial analysis on multiple global category features with different category labels to obtain inter-class evaluation index values; and a second evaluation submodule, used to determine the evaluation result based on the inter-class evaluation index values.
[0190] According to embodiments of this disclosure, the inter-class evaluation index value includes a global inter-class separation degree used to evaluate inter-class differences; the inter-class analysis submodule includes: an eighth index determination unit, used to determine the inter-class distance between multiple category labels based on the second class centers corresponding to the multiple category labels respectively; and a ninth index determination unit, used to determine the global inter-class separation degree based on the inter-class distance between multiple category labels and the intra-class variance of multiple category labels.
[0191] According to embodiments of this disclosure, the inter-class evaluation index value includes a confusion index value for evaluating the degree of inter-class confusion. The inter-class analysis submodule includes: a tenth index determination unit, used to determine multiple nearest neighbor features of each of the multiple global category features based on the distance between multiple global category features; an eleventh index determination unit, used to determine the number of features with category labels different from the global category features among the multiple nearest neighbor features for each global category feature; and a twelfth index determination unit, used to determine a confusion index value for the third category label based on the number of features of each of the multiple global category features with the third category label and the number of global category features with the third category label.
[0192] According to embodiments of this disclosure, the inter-class evaluation index value includes a semantic overlap index value used to evaluate the degree of semantic overlap between classes; the inter-class analysis submodule includes: a thirteenth index determination unit, used to determine the semantic overlap index value between the categories corresponding to the multiple category labels based on the second category centers corresponding to the multiple category labels respectively.
[0193] According to an embodiment of this disclosure, the evaluation module 720 further includes a third evaluation submodule, used to determine the evaluation result based on the intra-class evaluation index value and the inter-class evaluation index value.
[0194] According to an embodiment of this disclosure, the third evaluation submodule includes: a first evaluation unit, configured to determine a target evaluation result when the intra-class evaluation index value for the category corresponding to the fourth category label meets an abnormal condition and the inter-class evaluation index value meets a normal condition, wherein the target evaluation result is used to characterize multiple evaluations of the category corresponding to the fourth category label.
[0195] According to embodiments of this disclosure, the evaluation device 700 further includes: an enhancement module for enhancing multiple sample texts with a fourth category label to obtain multiple enhanced sample texts; a first update module for processing the multiple enhanced sample texts using a large language model to obtain the category features of each of the multiple enhanced sample texts; a second update module for performing intra-class space analysis on the category features of each of the multiple enhanced sample texts to obtain updated intra-class evaluation index values; and a third update module for determining the evaluation result of the large language model for the category corresponding to the fourth category label based on the updated intra-class evaluation index values.
[0196] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0197] According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method described above.
[0198] According to embodiments of the present disclosure, a non-transitory computer-readable storage medium stores computer instructions, wherein the computer instructions are used to cause a computer to perform the methods described above.
[0199] According to an embodiment of this disclosure, a computer program product includes a computer program that, when executed by a processor, implements the method described above.
[0200] Figure 8 A schematic block diagram of an artificial intelligence agent according to an embodiment of the present disclosure is shown.
[0201] In embodiments of this disclosure, the von Neumann architecture in modern computer theory is inspired, such as... Figure 8 As shown, the AI agent 800 may include five core modules: input module 810, processing module 820 and output module 830.
[0202] The input module 810 is responsible for receiving or sensing information such as queries, requests, instructions, signals, or data from the outside world (e.g., users or the external environment), and converting it into a format that the AI agent 800 can understand and process. The input module 810 is the primary link for the AI agent 800 to interact with the outside world. It enables the AI agent 800 to efficiently and accurately obtain the necessary "sensory" information from the outside world and respond to this information.
[0203] In the example, input module 810 can input the sample text described above.
[0204] In the example, the processing module 820 is the core support for the AI agent 800's ability to handle complex tasks. The processing module 820 is used to determine the target task based on the input information received by the input module 810, determine the large model based on the target task, and execute the evaluation method of the large language model described above by calling the large model.
[0205] In the example, output module 830 can output the evaluation results described above.
[0206] In the example, the processing module 820 may include a control unit 821, a storage unit 822, and a processing unit 823.
[0207] During operation, the control unit 821 will continuously interact with the storage unit 822, the arithmetic unit 823, and / or the output module 830. However, it should be noted that in the embodiments of this disclosure, the control unit 821 initiates communication with the storage unit 822, the arithmetic unit 823, and / or the output module 830 as a single initiator, and there is no communication coupling between the storage unit 822, the arithmetic unit 823, and the output module 830.
[0208] In the example, the performance of the control unit 821 is closely related to the large model on which the AI agent 800 is based. To fully leverage the capabilities of the large model, the internal structure of the control unit 821 can be designed to be highly configurable and scalable to handle various types of tasks and requirements in real-world scenarios.
[0209] Storage unit 822 can be responsible for remembering information such as historical dialogues and event streams.
[0210] The operation unit 823 can be viewed as a predefined tool library. Tools for intra-class space analysis and inter-class space analysis, as described above, can be included in the operation unit 823.
[0211] In the example, after acquiring input information, the AI agent 800 can use the input information to determine the target task and, based on the target task, determine a large model. The input information can be stored in the storage unit 822 of the processing module 820. The control unit 821 can call the large model to retrieve sample data from the storage unit 822 and process it to generate category features. The control unit 821 calls the operation module 823 to analyze the category features, determine the evaluation result, and store it in the storage unit 822, and / or the control unit 821 transmits the evaluation result as output information to the output module 830.
[0212] The AI agent 900 according to embodiments of this disclosure can simply and effectively improve the level of intelligence, as well as enhance flexibility and versatility.
[0213] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0214] According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method described above.
[0215] According to embodiments of the present disclosure, a non-transitory computer-readable storage medium stores computer instructions, wherein the computer instructions are used to cause a computer to perform the method described above.
[0216] According to an embodiment of this disclosure, a computer program product includes a computer program that, when executed by a processor, implements the method described above.
[0217] Figure 9 A block diagram of an electronic device suitable for implementing an evaluation method for large language models according to embodiments of the present disclosure is illustrated schematically. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0218] like Figure 9As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. The RAM 903 may also store various programs and data required for the operation of the electronic device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0219] Multiple components in electronic device 900 are connected to input / output (I / O) interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows electronic device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0220] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as the large language model evaluation method. For example, in some embodiments, the large language model evaluation method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the large language model evaluation method described above can be performed. Alternatively, in other embodiments, the computing unit 901 can be configured to perform the large language model evaluation method by any other suitable means (e.g., by means of firmware).
[0221] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0222] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0223] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0224] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0225] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0226] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, distributed system servers, or servers incorporating blockchain technology.
[0227] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0228] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An evaluation method for a large language model, comprising: Multiple sample texts are processed using a large language model to obtain category features for each sample text. Each sample text includes instruction subtexts that guide the large language model to generatively output the category of the sample text. The category features are mapped through the output layer of the large language model to obtain the category. Based on the category labels of the multiple sample texts, the classification performance of the multiple category features is evaluated to obtain the evaluation results of the classification performance of the large language model.
2. The method according to claim 1, wherein, The step of evaluating the classification performance of multiple category features based on the category labels of the multiple sample texts to obtain the evaluation result of the classification performance for the large language model includes: Feature extraction is performed on each of the multiple category features to obtain global category features corresponding to each of the multiple category features, wherein the multiple global category features have the same dimension; Perform intra-class spatial analysis on multiple global category features with the same category label to obtain intra-class evaluation index values; and The evaluation result is determined based on the intra-class evaluation index value.
3. The method according to claim 2, wherein, The in-class evaluation index values include structural index values used to evaluate whether there are multiple semantic structures within the class; The step of performing intra-class spatial analysis on multiple global category features with the same category label to obtain intra-class evaluation index values includes: Clustering multiple global category features with the same category label yields at least one intra-class sub-cluster; If the number of subclusters within a class is greater than a number threshold, the subcluster distance between the multiple subclusters within the class is determined; The structural index value includes at least one of the number of sub-clusters within the class and the sub-cluster distance.
4. The method according to claim 3, wherein, Determining the sub-cluster distances between the multiple intra-class sub-clusters includes: Based on multiple global category features belonging to the same intra-class sub-cluster, determine the first class center of each of the multiple intra-class sub-clusters; and The distance between multiple first-class centers is determined as the sub-cluster distance between multiple intra-class sub-clusters.
5. The method according to claim 3 or 4, wherein, The structural index value also includes: an anomaly silhouette coefficient used to assess whether global category features are misclassified; the method also includes: Anomaly features are determined from multiple global category features with a first category label, wherein the anomaly features are: global category features whose distances to the first category centers of multiple intra-class subclusters with the first category label are all greater than a distance threshold; and The abnormal profile coefficient is determined based on the distance between the abnormal feature and multiple global category features with a first category label, and the distance between the abnormal feature and multiple global category features with a second category label, wherein the second category label is different from the first category label.
6. The method according to claim 5, wherein, The step of determining the anomaly contour coefficient based on the distance between the anomaly feature and multiple global category features with first category labels, and the distance between the anomaly feature and multiple global category features with second category labels, includes: A first average distance is determined based on the distance between the abnormal feature and multiple global category features with a first category label; A second average distance is determined based on the distances between the anomalous features and multiple global category features with second category labels; and The abnormal contour coefficient is determined based on the difference between the second average distance and the first average distance.
7. The method according to claim 5, wherein, The second category label is determined using the following method: Based on the second class centers corresponding to the multiple class labels, the inter-class distances between the multiple class labels are determined, wherein the second class centers are determined using multiple global class features with the same class label; and Based on the inter-class distances between the multiple category labels, determine the second category label that has the smallest distance to the first category label.
8. The method according to any one of claims 2 to 7, wherein, The intra-class evaluation metrics include intra-class variance and intra-class average distance, used to evaluate intra-class spatial distribution; the intra-class spatial analysis of multiple global category features with the same category label to obtain intra-class evaluation metrics includes: Determine the second class center of multiple global category features that have the same category label; and The intra-class variance and intra-class average distance are determined based on the distances between the global category features of the same category label and the second class center.
9. The method according to any one of claims 2 to 8, further comprising: Inter-class spatial analysis is performed on multiple global category features with different category labels to obtain inter-class evaluation index values; as well as The evaluation result is determined based on the inter-class evaluation index value.
10. The method according to claim 9, wherein, The inter-class evaluation metric includes a global inter-class separation degree used to assess inter-class differences; the step of performing inter-class spatial analysis on multiple global category features with different category labels to obtain the inter-class evaluation metric includes: Based on the second category centers corresponding to the multiple category labels, determine the inter-class distances between the multiple category labels; The global inter-class separation degree is determined based on the inter-class distance between the multiple category labels and the intra-class variance of the multiple category labels.
11. The method according to claim 9, wherein, The inter-class evaluation index values include confusion index values used to assess the degree of inter-class confusion. The step of performing inter-class spatial analysis on multiple global category features with different category labels to obtain the inter-class evaluation index values includes: Based on the distance between multiple global category features, determine the multiple nearest neighbor features of each of the multiple global category features; For each of the global category features, determine the number of category labels that differ from the global category feature among multiple nearest neighbor features; and The confusion index value for the third category label is determined based on the number of features of each of the global category features with the third category label and the number of global category features with the third category label.
12. The method according to claim 9, wherein, The inter-class evaluation index values include semantic overlap index values used to evaluate the degree of semantic overlap between classes; the step of performing inter-class spatial analysis on multiple global category features with different category labels to obtain inter-class evaluation index values includes: Based on the second category center corresponding to each of the multiple category labels, determine the semantic overlap index value between the categories corresponding to the multiple category labels.
13. The method according to any one of claims 2 to 12, wherein, The method further includes: The evaluation result is determined based on the intra-class evaluation index value and the inter-class evaluation index value.
14. The method according to claim 13, wherein, Determining the evaluation result based on the intra-class evaluation index value and the inter-class evaluation index value includes: If the intra-class evaluation index value for the category corresponding to the fourth category label meets the abnormal condition and the inter-class evaluation index value meets the normal condition, the target evaluation result is determined, wherein the target evaluation result is used to characterize the multiple evaluations performed on the category corresponding to the fourth category label.
15. The method according to claim 14, wherein, The method further includes: Based on the intra-class evaluation index value, sample augmentation is performed on multiple sample texts with the fourth category label to obtain multiple augmented sample texts; and The large language model is used to process multiple enhanced sample texts to obtain the category features of each enhanced sample text. Intra-class spatial analysis is performed on the category features of each of the multiple enhanced sample texts to obtain updated intra-class evaluation index values; Based on the updated intra-class evaluation index value, the evaluation result of the large language model for the category corresponding to the fourth category label is determined.
16. An evaluation device for a large language model, comprising: A feature acquisition module is used to process multiple sample texts using a large language model to obtain category features for each of the sample texts. The sample texts include instruction subtexts, which guide the large language model to generatively output the category of the sample text. The category features are mapped through the output layer of the large language model to obtain the category. The evaluation module is used to evaluate the classification performance of multiple category features based on the category labels of the multiple sample texts, and obtain the evaluation result of the classification performance for the large language model.
17. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 15.
18. An intelligent agent based on artificial intelligence, comprising: The input module is used to receive input information; The processing module is configured to determine a target task based on the input information received by the input module, determine a large model based on the target task, and execute the method of any one of claims 1 to 15 by calling the large model to obtain output information; An output module is used to output the output information obtained by the processing module.
19. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 15.
20. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 15.