Methods, apparatus and electronic devices for generating boundary samples based on large models

By generating semantic adversarial strategies and calculating boundary scores using a large model, high-quality boundary samples are selected, the target classification model is optimized, the problem of scarce boundary samples is solved, and the model's recognition ability and robustness at classification boundaries are improved.

CN122132830APending Publication Date: 2026-06-02BEIJING BAIDU NETCOM SCI & TECH CO LTD

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-20
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, boundary samples are scarce and difficult to cover, resulting in insufficient recognition accuracy of the model at classification boundaries, especially when dealing with semantically ambiguous and intentionally concealed inputs.

Method used

Candidate texts are generated using a large-model-based semantic adversarial strategy. The target classification model is then combined with category prediction and boundary score calculation to select high-quality boundary samples. Finally, the target classification model is optimized through an automated process.

Benefits of technology

It significantly improves the model's ability to distinguish semantically ambiguous and intentionally concealed inputs, enhances the model's robustness and generalization performance, and improves classification accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122132830A_ABST
    Figure CN122132830A_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, and electronic device for generating boundary samples based on a large model, relating to the field of computer technology, particularly to artificial intelligence fields such as deep learning and large models. The specific implementation scheme is as follows: Based on a first large model, a semantic adversarial strategy is employed to obtain first candidate text; a target classification model is used to predict the category of the first candidate text, obtaining the first classification probability of the first candidate text belonging to each category; based on the first classification probability of the first candidate text belonging to each category, a first boundary score of the first candidate text is determined; wherein, the first boundary score is used to quantify the boundary attribute of the first candidate text in the target classification model; based on the first boundary score, boundary samples of the target classification model are determined from the first candidate text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to the field of artificial intelligence such as deep learning and large models, specifically to a method, apparatus and electronic device for generating boundary samples based on a large model. Background Technology

[0002] With the widespread application of deep learning technology in fields such as content risk control and intent recognition, the improvement of model performance increasingly depends on the scale and quality of training data. Regular samples are usually easy to obtain and the model has a high recognition accuracy for them, but samples at the classification boundary (i.e., boundary samples) are often scarce and difficult to cover. Summary of the Invention

[0003] This application provides a method, apparatus, and electronic device for generating boundary samples based on a large model. The specific solution is as follows: According to one aspect of this application, a boundary sample generation method based on a large model is provided, comprising: Based on the first major model, a semantic adversarial strategy is adopted to obtain the first candidate text; Using a target classification model, the category of the first candidate text is predicted to obtain the first classification probability of the first candidate text belonging to each category; The first boundary score of the first candidate text is determined based on the first classification probability of each category; whereby the first boundary score is used to quantify the boundary attribute of the first candidate text in the target classification model. Based on the first boundary score, the boundary samples of the target classification model are determined from the first candidate text.

[0004] According to another aspect of this application, a boundary sample generation apparatus based on a large model is provided, comprising: The acquisition module is used to acquire the first candidate text based on the first major model and employing a semantic adversarial strategy. The prediction module is used to use a target classification model to predict the category of the first candidate text and obtain the first classification probability of the first candidate text belonging to each category. The first determining module is used to determine the first boundary score of the first candidate text based on the first classification probability of the first candidate text belonging to each category; wherein, the first boundary score is used to quantify the boundary attribute of the first candidate text in the target classification model; The second determination module is used to determine the boundary samples of the target classification model from the first candidate text based on the first boundary score.

[0005] According to another aspect of this application, 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 that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method described in the above embodiments.

[0006] According to another aspect of this application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to perform the method described in the above embodiments.

[0007] According to another aspect of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the method described in the above embodiments.

[0008] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0009] The accompanying drawings are provided for a better understanding of this solution and do not constitute a limitation of this application. Wherein: Figure 1 A flowchart illustrating a boundary sample generation method based on a large model provided in an embodiment of this application; Figure 2 A flowchart illustrating a boundary sample generation method based on a large model, provided for another embodiment of this application; Figure 3 A flowchart illustrating a boundary sample generation method based on a large model, provided for another embodiment of this application; Figure 4 A schematic diagram of the structure of a boundary sample generation device based on a large model provided in an embodiment of this application; Figure 5 This is a block diagram of an electronic device used to implement the boundary sample generation method based on a large model according to the embodiments of this application. Detailed Implementation

[0010] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These 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 application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0011] It should be noted that the acquisition, storage, use, and processing of data in this application comply with the relevant provisions of national laws and regulations and do not violate public order and good morals.

[0012] The following description, with reference to the accompanying drawings, outlines a method, apparatus, electronic device, and storage medium for generating boundary samples based on a large model, according to embodiments of this application.

[0013] Figure 1 This is a flowchart illustrating a boundary sample generation method based on a large model, provided in an embodiment of this application.

[0014] The boundary sample generation method based on a large model according to the embodiments of this application can be executed by the boundary sample generation device based on a large model according to the embodiments of this application, which can be configured in an electronic device.

[0015] Among them, electronic devices can be any device with computing capabilities, such as personal computers, mobile terminals, servers, etc. Mobile terminals can be hardware devices with various operating systems, touch screens and / or displays, such as in-vehicle devices, mobile phones, tablets, personal digital assistants, wearable devices, etc.

[0016] like Figure 1 As shown, this method for generating boundary samples based on a large model: Step 101: Based on the first major model, a semantic adversarial strategy is adopted to obtain the first candidate text.

[0017] In this application, semantic adversarial refers to adversarial interference at the semantic level. Semantic adversarial strategies can refer to embedding content with the intent to interfere, mislead, or circumvent the target audience by using specific generation goals, constraints, or prompting methods, so that the text output by the large model can maintain its surface rationality or certain category of semantic features.

[0018] For example, semantic adversarial strategies include generating targets, which require the generated text to be semantically close to category C, but also to have certain interfering information, making it difficult to be easily judged.

[0019] For example, the first candidate text may include text generated by the first large model using a semantic adversarial strategy, or text obtained by applying boundary interference to the text generated by the first large model using a semantic adversarial strategy, etc., without limitation.

[0020] As an example, the first major model can be used to make minor semantic modifications to the generated text, making it cross or approach the classification boundary. For example, a prompt message could be: "Please modify this text so that it does not contain obvious emotional words, but still conveys a negative attitude. {Text to be modified}".

[0021] In this application, the text generated by the first model using a semantic adversarial strategy is subjected to boundary interference, which can improve the diversity of boundary samples.

[0022] It should be noted that there can be one or more first candidate texts, and there is no limit to this.

[0023] Step 102: Using a target classification model, predict the category of the first candidate text to obtain the first classification probability of the first candidate text belonging to each category.

[0024] Since the first candidate text is not necessarily a semantically adversarial text, in order to improve the quality of the boundary samples, this application can use a target classification model to predict the category of the first candidate text, and then filter the first candidate text based on the category prediction results.

[0025] In this application, the target classification model is a classification model to be optimized. The first candidate text can be input into the target classification model for category prediction, and the first classification probability of the first candidate text belonging to each category is obtained from the output of the target classification model.

[0026] For example, if the target classification model has three categories, namely category a, category b, and category c, by classifying the first candidate text using the target classification model, we can obtain the classification probability of the first candidate text belonging to category a, the classification probability of belonging to category b, and the classification probability of belonging to category c.

[0027] Step 103: Determine the first boundary score of the first candidate text based on the first classification probability of the first candidate text belonging to each category.

[0028] In this application, the first boundary score can be used to quantify the boundary attributes of the first candidate text in the target classification model.

[0029] For example, the first boundary score can be used to characterize the degree of uncertainty of the target classification model regarding the first candidate text. For example, the boundary score can also be described as prediction entropy, and this application does not limit the name of the boundary score.

[0030] For example, the cross-entropy can be determined based on the first classification probability of the first candidate text belonging to each category, and the first boundary score can be determined based on the cross-entropy.

[0031] Step 104: Based on the first boundary score, determine the boundary samples of the target classification model from the first candidate text.

[0032] In this application, since the first boundary score can be used to quantify the boundary attributes of the first candidate text in the target classification model, the first candidate text can be screened based on the first boundary score, and high-quality boundary samples can be selected from the first candidate text as training data for the target classification model to optimize the target classification model.

[0033] In this embodiment, by using a semantic adversarial strategy based on the first major model, the first candidate text is obtained, and the boundary score is determined by using the first classification probability of the first candidate text belonging to each category predicted by the target classification model. This quantifies the boundary attributes of the first candidate text in the target classification model, which can accurately locate the decision blind spot of the target classification model. Based on the boundary score, high-value boundary samples are selected from the first candidate text and used as training data to optimize the target classification model. This can significantly improve the target classification model's ability to discriminate inputs with semantic ambiguity, hidden intent, or those in a class borderline state, thereby effectively enhancing the model's robustness, generalization performance, and classification accuracy.

[0034] Figure 2 A flowchart illustrating a boundary sample generation method based on a large model, provided for another embodiment of this application.

[0035] like Figure 2 As shown, this boundary sample generation method based on a large model includes: Step 201: Select target seed data from the seed library.

[0036] In this application, the seed library may be constructed based on difficult texts determined by the target classification model.

[0037] For example, target seed data extracted from the seed bank may include, but is not limited to, keywords, semantic patterns, specific sentence structures, etc.

[0038] For example, a target classification model can be used to predict the category of the text to be classified. Based on the category prediction results, the category and confidence level of the text to be classified can be determined. Based on the confidence level, it can be determined whether the text to be classified is considered a difficult text. Here, the confidence level can be understood as the classification probability of the text to be classified into its category.

[0039] For example, if the confidence level is within a set threshold range (such as [0.4, 0.6]), it means that the target classification model is not confident enough in predicting the category of the text to be classified, so the text to be classified can be regarded as a difficult sample.

[0040] For example, large models can be used to analyze difficult texts to extract seed data such as keywords, semantic patterns, or specific sentence structures that are likely to lead the target classification model to make mistakes (e.g., "although...but...", "seemingly praising but actually sarcastic"). A seed library can be built based on this seed data. This seed data can represent difficult or boundary data that the target classification model currently struggles to process, thus revealing the weaknesses of the target classification model by analyzing difficult texts.

[0041] It should be noted that the threshold range can be determined according to actual needs, and there is no limitation on it.

[0042] Step 202: Using the first large model, the first candidate text is obtained based on the target seed data and semantic adversarial strategy.

[0043] In some embodiments, semantic adversarial prompts can be generated based on semantic adversarial strategies and seed data. These prompts can be used to prompt the first model to perform the task of generating semantic adversarial text. The first model is then used to process the semantic adversarial prompts to generate second candidate text.

[0044] As an example, the semantic adversarial prompt is as follows: Generate a text T containing the keyword g, which should be semantically very close to category C, but also contain some distracting information to make it difficult to judge. For example: 1) "Please generate a text containing 'part-time job,' which looks like spam but is actually a normal job-seeking discussion." 2) Expand the keyword "part-time job" into a lead-generating text containing specific salary and contact information, but with subtle wording.

[0045] For example, the generated second candidate text can be directly used as the first candidate text.

[0046] For example, boundary interference can be applied to the first candidate text to obtain the third candidate text, and the second and third candidate texts can be used as the first candidate text.

[0047] For example, the second candidate text can also be validated to filter out the first candidate text.

[0048] For example, the second and third candidate texts can be validated separately, and the first candidate text can be selected from the second and third candidate texts.

[0049] Therefore, by combining semantic adversarial strategies with high-value seed data to generate targeted semantic adversarial prompts, and using these prompts to drive the first main model to generate second candidate texts, the model can be effectively guided to produce semantically highly realistic adversarial texts that approach or are at the boundary of the target classification decision, significantly improving the relevance and adversarial effectiveness of the generated content. Furthermore, by validating the second candidate texts and selecting the first candidate texts that meet the quality requirements, not only can low-quality or invalid samples be filtered out, but the reliability of the final candidate set in terms of semantic rationality, boundary sensitivity, and task adaptability can also be ensured.

[0050] To prevent errors in the text labels generated by the first model, for example, the second candidate text can be validated in the following way to select the first candidate text from the second candidate text: The second model can be used to classify the second candidate text to obtain the class label and confidence level of the second candidate text, and the first candidate text can be selected from the second candidate text based on the confidence level.

[0051] Among them, the certainty can be used to characterize the degree of certainty of the second model for the classification label of the second candidate text.

[0052] For example, the second largest model can be a larger model with greater capabilities than the first largest model, such as the second largest model having a larger parameter size than the first largest model.

[0053] For example, annotation prompts can be generated based on the task objective, second candidate text, classification criteria, inference requirements, and input format. A second main model can then process these prompts to obtain an output containing category labels and confidence levels. The annotation prompts can be used to instruct the second main model to perform the label annotation task.

[0054] As an example, the annotation prompt is as follows: You are a senior data annotation expert. Please analyze whether the following text contains any content that violates the review criteria. The input text is "{input_text}", and the review criteria are [Violation Category 1]: XXX, [Violation Category 2]: XXX, [Violation Category 3]: XXX; Reasoning requirements: Please first extract the keywords and variant words in the text, analyze the context, and compare them one by one with the above review criteria; Output format: {"reasoning": "detailed reasoning process...", "category": "Violation Category / Normal", "confidence": 3 indicates very certain, 2 indicates generally certain, 1 indicates uncertain, "keywords": ["extracted keywords"]}.

[0055] For example, the confidence level can be represented by a confidence level, and a second candidate text with a confidence level of a preset level can be used as the first candidate text. Alternatively, the confidence level can be represented by a numerical value, and a second candidate text with a confidence level greater than a preset threshold can be used as the first candidate text.

[0056] For example, if the second largest model has a low confidence level in the second candidate text, it means that the second largest model is also unable to determine its category, and the second candidate text is regarded as invalid noise and discarded.

[0057] Therefore, by using the second largest model to classify the second candidate text, and filtering the second candidate text based on the confidence level of the class, the consistency verification of the second candidate text can be achieved, that is, to verify whether the generated text is consistent with the expected text. Based on the consistency verification of the second candidate text, high-quality labeled data can be selected from the second candidate text.

[0058] Optionally, the second candidate text can be first validated according to the preset text rules. If the second candidate text passes the rule validation, the second model can then be used to label the second candidate text by category.

[0059] For example, text rules may include text length between a first length and a second length, text formatting as a preset format, etc. Then, by using these text rules to perform rule validation on the second candidate text, text that is too long or too short, or has obvious formatting errors, can be filtered out.

[0060] Therefore, the second candidate text is first validated according to rules to filter out texts that do not conform to the text rules. Then, the remaining text is labeled with the second major model, which is to perform consistency verification. Through double verification, the second candidate text is filtered to obtain high-quality first candidate text.

[0061] For example, one or more of the following checks can be performed on the second candidate text: rule check and consistency check. The text that passes the corresponding check is used as the first candidate text.

[0062] Step 203: Using the target classification model, the first candidate text is classified into categories to obtain the first classification probability of the first candidate text belonging to each category.

[0063] In this application, step 203 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0064] Step 204: Determine the first boundary score of the first candidate text based on the first classification probability of the first candidate text belonging to each category.

[0065] In some embodiments, for each category, the product of the first classification probability and the logarithm of the first classification probability can be determined, and the first boundary score can be obtained based on the sum of the products corresponding to each category.

[0066] For example, the first candidate text Boundary score The calculation formula (1) is shown below: (1) in, Represents the target classification model The number of categories; Represents the target classification model Predicted text Category The probability of.

[0067] Therefore, by calculating the product of the first classification probability and its logarithm, and summing the products corresponding to each category, the first boundary score is obtained, thereby effectively quantifying the boundary attributes of candidate texts in the target classification model based on information entropy.

[0068] Step 205: Based on the first boundary score, determine the boundary samples of the target classification model from the first candidate text.

[0069] In some embodiments, a threshold range corresponding to the target classification model can be determined, the first boundary score of the first candidate text can be compared with the upper and lower limits of the threshold range to determine the relationship between the first boundary score and the threshold range, and the boundary samples of the target classification model can be screened and determined from the first candidate text based on the relationship.

[0070] For example, if the first boundary score of the first candidate text is greater than the upper limit of the threshold range, it indicates that the target classification model is extremely confused about the first candidate text, and the predicted distribution tends to be uniform. In this case, the first candidate text is identified as a high-quality boundary sample. If the first boundary score is within the threshold range, the first candidate text can be added to the candidate text set, and then texts representing the target proportion can be selected from the candidate text set as boundary samples.

[0071] For example, random sampling can be performed on the candidate text set, and the sampled text can be used as boundary samples.

[0072] For example, if the first boundary score of the first candidate text is less than the lower limit of the threshold range, it means that the first candidate text is relatively simple and the target classification model is relatively confident in classifying the first candidate text, so the first candidate text can be discarded.

[0073] For example, setting the threshold range as ,if This indicates that the target classification model has identified the first candidate text. Extremely confused, can the first candidate text be... As boundary samples, if The first candidate text can be Discard, if The first candidate text is added to the candidate text set, and the text in the candidate text set is randomly sampled. The sampled text is used as the boundary sample.

[0074] It should be noted that different target classification models may have the same or different threshold ranges, which can be determined according to actual needs, and there is no limitation on this.

[0075] Therefore, by filtering the first candidate text based on the relationship between the boundary score of the first candidate text and the threshold range, high-quality boundary samples can be selected.

[0076] It should be noted that after generating the second candidate text using the first model each time, the first candidate text can be determined from the second candidate text, and then the boundary score of the first candidate text can be used to determine whether the first candidate text is a boundary sample. Alternatively, a set containing multiple first candidate texts can be obtained in advance, and the boundary scores of the texts in the set can be used to filter out the boundary samples from the set. There is no limitation on this.

[0077] In this embodiment, seed data is selected from a seed library, and the seed data, combined with a semantic adversarial strategy, guides the generation of adversarial models. This can effectively cover sparse edge scenarios and significantly improve the robustness and generalization ability of target classification models in complex real-world environments.

[0078] Figure 3 A flowchart illustrating a boundary sample generation method based on a large model, provided for another embodiment of this application.

[0079] like Figure 3 As shown, this boundary sample generation method based on a large model includes: Step 301: Based on the first major model, a semantic adversarial strategy is adopted to obtain the first candidate text.

[0080] Step 302: Using a target classification model, the first candidate text is classified into categories to obtain the first classification probability of the first candidate text belonging to each category.

[0081] Step 303: Determine the first boundary score of the first candidate text based on the first classification probability of the first candidate text belonging to each category.

[0082] Step 304: Based on the first boundary score, determine the boundary samples of the target classification model from the first candidate text.

[0083] In this application, steps 301-304 can be implemented in any of the embodiments of this application, so they will not be described in detail here.

[0084] Step 305: Using the target classification model, the category of the boundary sample is predicted to obtain the second classification probability of the boundary sample belonging to each category.

[0085] In this application, the boundary samples obtained by the above steps can be added to the training set of the target classification model.

[0086] For example, boundary samples from the training set can be used to train the target classification model. Alternatively, the boundary samples can be input into the target classification model to predict the category, yielding the second classification probability output by the target classification model indicating whether the boundary sample belongs to each category.

[0087] Step 306: Determine the second boundary score of the boundary sample based on the second classification probability of the boundary sample belonging to each category.

[0088] In this application, the calculation method for the second boundary score is similar to that for the first boundary score, so it will not be repeated here. For example, the second boundary score can be calculated using the above formula (1), so it will not be repeated here.

[0089] Step 307: Train the target classification model based on the second boundary score and the second classification probability of the boundary sample belonging to each category.

[0090] In order to enable the target classification model to learn boundary samples, this application can determine the model loss based on the second boundary score and the second classification probability of the boundary sample belonging to each category. Based on the model loss, the parameters of the target classification model are adjusted to obtain the trained target classification model.

[0091] In some embodiments, the cross-entropy loss can be determined based on the second classification probability of the boundary sample belonging to each category, and the weight of the cross-entropy loss can be determined based on the second boundary score. The model loss can be determined based on the product of the weight and the cross-entropy loss, and the target classification model can be trained based on the model loss.

[0092] For example, the model loss can be calculated using the following formula (2). : (2) in, N Indicates the number of boundary samples. Indicates the focusing coefficient. Representing boundary samples Boundary score, This indicates the number of categories in the target classification model. Representing boundary samples Category k The tag or one-hot encoding, Boundary samples representing the target type model predictions Category k The classification probability.

[0093] The meaning of formula (2) is that for boundary samples with higher boundary scores (more difficult samples), the weight of their loss in the model loss is greater, forcing the model to prioritize optimizing the parameters of these boundary samples during gradient descent.

[0094] Therefore, by introducing dynamic weights based on boundary scores into the model loss, the target classification model can focus on learning boundary samples, which can significantly improve the accuracy of the model under fuzzy semantics (such as irony and metaphor).

[0095] In this embodiment, by combining the second classification probability of boundary samples and their corresponding second boundary scores to train the target classification model, the learning ability of the model in the decision boundary region can be effectively enhanced. Since a higher boundary score indicates that the boundary sample is closer to the fuzzy region or critical state of class determination, introducing it as a supervision signal into the training process can guide the model to more finely characterize the class boundary and enhance its ability to distinguish samples with semantic ambiguity, hidden intent, or in a critical state. This not only improves the classification accuracy of the model in high uncertainty regions but also significantly enhances its robustness and generalization performance. Furthermore, a fully automated process from "mining-generating-screening-training" is constructed, enabling continuous iteration of the model without excessive manual intervention.

[0096] To achieve the above embodiments, this application also proposes a boundary sample generation device based on a large model. Figure 4 This is a schematic diagram of the structure of a boundary sample generation device based on a large model provided in an embodiment of this application.

[0097] like Figure 4 As shown, the boundary sample generation device 400 based on a large model includes: The acquisition module 410 is used to acquire the first candidate text based on the first large model and employing a semantic adversarial strategy. The prediction module 420 is used to use a target classification model to predict the category of the first candidate text and obtain the first classification probability of the first candidate text belonging to each category. The first determining module 430 is used to determine the first boundary score of the first candidate text based on the first classification probability of the first candidate text belonging to each category; wherein, the first boundary score is used to quantify the boundary attribute of the first candidate text in the target classification model; The second determining module 440 is used to determine the boundary samples of the target classification model from the first candidate text based on the first boundary score.

[0098] Optionally, module 410 is used for: Select target seed data from the seed bank; wherein the seed bank is constructed based on difficult texts determined by the target classification model; The first model is used to obtain the first candidate text based on the target seed data and semantic adversarial strategy.

[0099] Optionally, module 410 is used for: Based on the semantic adversarial strategy and seed data, semantic adversarial prompts are generated; these prompts are used to prompt the first model to perform the task of generating semantic adversarial text. The first model is used to process the semantic adversarial prompts and generate the second candidate text; The second candidate text is validated in order to select the first candidate text from the second candidate text.

[0100] Optionally, module 410 is used for: The second largest model is used to classify the second candidate text to obtain the class label and confidence level of the second candidate text; the parameter size of the second largest model is larger than that of the first largest model, and the confidence level is used to characterize the degree of certainty of the second largest model in terms of the classification label. Based on the confidence level, the first candidate text is selected from the second candidate text.

[0101] Optionally, module 410 is used for: According to the preset text rules, the second candidate text is validated according to the rules. If the second candidate text passes the rule validation, the second largest model is used to label the category of the second candidate text.

[0102] Optionally, the first determining module 430 is used for: Determine the threshold range corresponding to the target classification model; In response to the first boundary score being greater than the upper limit of the threshold range, the first candidate text is identified as the boundary sample; In response to the first boundary score being within the threshold range, the first candidate text is added to the candidate text set to select a target proportion of text as boundary samples from the candidate text set.

[0103] Optionally, the second determining module 440 is used for: Determine the product of the first classification probability and the logarithm of the first classification probability; The first boundary score is obtained based on the sum of the products corresponding to each category.

[0104] Optionally, the prediction module 420 is also used to use a target classification model to predict the category of the boundary sample and obtain the second classification probability of the boundary sample belonging to each category. The first determining module 430 is also used to determine the second boundary score of the boundary sample based on the second classification probability of the boundary sample belonging to each category; The device may also include a training module for training the target classification model based on the second boundary score and the second classification probability that the boundary sample belongs to each category.

[0105] Optionally, the training module is used for: The cross-entropy loss is determined based on the second classification probability of each category belonging to the boundary sample; The weights of the cross-entropy loss are determined based on the second boundary score. The model loss is determined by the product of the weights and the cross-entropy loss. The target classification model is trained based on the model loss.

[0106] It should be noted that the explanation of the aforementioned embodiment of the boundary sample generation method based on a large model also applies to the boundary sample generation device based on a large model in this embodiment, so it will not be repeated here.

[0107] In this embodiment, by using a semantic adversarial strategy based on the first major model, the first candidate text is obtained, and the boundary score is determined by using the first classification probability of the first candidate text belonging to each category predicted by the target classification model. This quantifies the boundary attributes of the first candidate text in the target classification model, which can accurately locate the decision blind spot of the target classification model. Based on the boundary score, high-value boundary samples are selected from the first candidate text and used as training data to optimize the target classification model. This can significantly improve the target classification model's ability to discriminate inputs with semantic ambiguity, hidden intent, or those in a class borderline state, thereby effectively enhancing the model's robustness, generalization performance, and classification accuracy.

[0108] According to embodiments of this application, this application also provides an electronic device, a readable storage medium, and a computer program product.

[0109] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of this application is shown. 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 application described and / or claimed herein.

[0110] like Figure 5 As shown, device 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 502 or a computer program loaded from storage unit 508 into RAM (Random Access Memory) 503. RAM 503 can also store various programs and data required for the operation of device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. I / O (Input / Output) interface 505 is also connected to bus 504.

[0111] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0112] The computing unit 501 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as the large model-based boundary sample generation method. For example, in some embodiments, the large model-based boundary sample generation method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the large model-based boundary sample generation method described above can be performed. Alternatively, in other embodiments, computing unit 501 may be configured by any other suitable means (e.g., by means of firmware) to perform a boundary sample generation method based on a large model.

[0113] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations 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.

[0114] The program code used to implement the methods of this application 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 device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are 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.

[0115] In the context of this application, 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, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0116] 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).

[0117] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users 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., communication networks). Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.

[0118] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.

[0119] According to an embodiment of this application, this application also provides a computer program product that, when an instruction processor in the computer program product is executed, performs the boundary sample generation method based on a large model proposed in the above embodiments of this application.

[0120] 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 application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.

[0121] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. 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 application should be included within the scope of protection of this application.

Claims

1. A boundary sample generation method based on a large model, comprising: Based on the first major model, a semantic adversarial strategy is adopted to obtain the first candidate text; Using a target classification model, the first candidate text is classified to predict its category, thus obtaining the first classification probability of the first candidate text belonging to each category. Based on the first classification probability of the first candidate text belonging to each category, a first boundary score of the first candidate text is determined; wherein, the first boundary score is used to quantify the boundary attribute of the first candidate text in the target classification model; Based on the first boundary score, the boundary samples of the target classification model are determined from the first candidate text.

2. The method as described in claim 1, wherein, The method, based on the first major model, employs a semantic adversarial strategy to obtain the first candidate text, including: Select target seed data from a seed bank; wherein the seed bank is constructed based on difficult texts determined by the target classification model; Using the first large model, the first candidate text is obtained based on the target seed data and the semantic adversarial strategy.

3. The method as described in claim 2, wherein, The step of using the first large model to obtain the first candidate text based on the target seed data and the semantic adversarial strategy includes: Based on the semantic adversarial strategy and the seed data, semantic adversarial prompt information is generated; wherein, the semantic adversarial prompt information is used to prompt the first large model to perform the task of generating semantic adversarial text; The first large model is used to process the semantic adversarial prompt information to generate a second candidate text; The second candidate text is validated to filter out the first candidate text from the second candidate text.

4. The method of claim 3, wherein, The step of validating the second candidate text to filter out the first candidate text from the second candidate text includes: A second large model is used to classify the second candidate text to obtain the class label and confidence level of the second candidate text; wherein, the parameter size of the second large model is larger than that of the first large model, and the confidence level is used to characterize the degree of certainty of the second large model for the classification label; Based on the stated confidence level, the first candidate text is selected from the second candidate text.

5. The method of claim 4, wherein, The second major model is used to classify the second candidate text, including: According to the preset text rules, the second candidate text is validated according to the rules. In response to the second candidate text passing the rule validation, the second large model is used to classify the second candidate text.

6. The method of claim 1, wherein, The step of determining the boundary samples of the target classification model from the first candidate text based on the first boundary score includes: Determine the threshold range corresponding to the target classification model; In response to the first boundary score being greater than the upper limit of the threshold range, the first candidate text is determined as the boundary sample; In response to the first boundary score being within the threshold range, the first candidate text is added to the candidate text set to select a target proportion of text from the candidate text set as the boundary sample.

7. The method of claim 1, wherein, The step of determining the first boundary score of the first candidate text based on the first classification probability of the first candidate text belonging to each category includes: Determine the product of the first classification probability and the logarithm of the first classification probability; The first boundary score is obtained based on the sum of the products corresponding to each category.

8. The method according to any one of claims 1-7, further comprising: Using the target classification model, the boundary sample is classified to obtain the second classification probability of the boundary sample belonging to each category; The second boundary score of the boundary sample is determined based on the second classification probability of the boundary sample belonging to each category; The target classification model is trained based on the second boundary score and the second classification probability of the boundary sample belonging to each category.

9. The method of claim 8, wherein, The step of training the target classification model based on the second boundary score and the second classification probability of the boundary sample belonging to each category includes: The cross-entropy loss is determined based on the second classification probability of the boundary sample belonging to each category; The weights of the cross-entropy loss are determined based on the second boundary score. The model loss is determined by the product of the weights and the cross-entropy loss. The target classification model is trained based on the model loss.

10. A boundary sample generation device based on a large model, comprising: The acquisition module is used to acquire the first candidate text based on the first major model and employing a semantic adversarial strategy. The prediction module is used to use a target classification model to predict the category of the first candidate text and obtain the first classification probability of the first candidate text belonging to each category. The first determining module is used to determine the first boundary score of the first candidate text based on the first classification probability of the first candidate text belonging to each category; wherein, the first boundary score is used to quantify the boundary attribute of the first candidate text in the target classification model; The second determining module is used to determine the boundary samples of the target classification model from the first candidate text based on the first boundary score.

11. 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-9.

12. 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-9.

13. A computer program product comprising a computer program that, when executed by a processor, implements the steps of the method according to any one of claims 1-9.