A method, device, and medium for labeling core guidance in news content

By optimizing the macBERT model using a large language model and dynamic distillation techniques, the problems of error accumulation and insufficient consistency in traditional news annotation methods are solved, achieving efficient and accurate news core orientation annotation, and improving the quality of the annotated dataset and the model's classification performance.

CN120470127BActive Publication Date: 2025-11-14COMMUNICATION UNIVERSITY OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510948263.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-11-14
Estimated Expiration
2045-07-10

AI Technical Summary

Technical Problem

Traditional news content annotation methods are prone to error accumulation and insufficient consistency and accuracy of overall annotation in complex scenarios. Furthermore, they lack a unified model for collaborative optimization, making it difficult to balance the comprehensiveness and accuracy of annotation.

Method used

We employ a large language model and dynamic distillation technique, using semantic similarity for initial annotation, cross-entropy loss and Gaussian mixture model to select confidence samples, construct dialogue prompt templates, optimize the macBERT model, and generate a high-quality core guidance annotation dataset.

Benefits of technology

It improved the accuracy and consistency of news content labeling, ensured the comprehensiveness and precision of labeling, and enhanced the classification performance of the text classification model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120470127B_ABST
    Figure CN120470127B_ABST
Patent Text Reader

Abstract

This application discloses a method, device, and medium for core guidance annotation of news content, relating to the field of electronic digital data processing technology. The method includes: dividing a pre-defined news text dataset into an labeled text example pool and an unlabeled text dataset; performing preliminary annotation on the unlabeled text dataset to obtain a weakly labeled text dataset; selecting target confidence samples from the weakly labeled text dataset, and generating a target sample set with target pseudo-labels based on the target confidence samples using a pre-defined selection strategy; constructing a dialogue prompt template based on semantic nearest neighbor samples, and outputting refined pseudo-labels corresponding to the weakly labeled text dataset using a pre-defined macBERT model; inputting the target sample set and the text to be refined as a training set into the macBERT model for training, obtaining a trained text classification model, and outputting the core guidance annotations for the news to be annotated using the text classification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic digital data processing technology, specifically to a method, device, and medium for core guidance labeling of news content. Background Technology

[0002] In today's data-driven era of artificial intelligence, data annotation plays a crucial role in various fields as a key means of constructing high-quality datasets. In news reporting, the accurate expression of the core message is of paramount importance. By precisely extracting and structurally annotating the core message from news texts, users can quickly grasp the core message of a report from massive amounts of news, reducing the difficulty of obtaining relevant information and providing strong support for online content governance.

[0003] However, traditional annotation methods mainly rely on manual operation and adopt a multi-stage output process. When dealing with complex scenarios such as the wide range of news content, strong context dependence, and implicit and overlapping directional expressions, it is easy to cause the accumulation of errors in each stage and the poor transmission of errors. For example, inaccurate identification of key trigger words will affect the development of subsequent annotation tasks, and the failure to share a unified model for collaborative optimization between stages makes it difficult to ensure the consistency and accuracy of the overall annotation. Summary of the Invention

[0004] To address the aforementioned issues, this application proposes a method for labeling the core orientation of news content, including:

[0005] Based on the text examples carrying the core guidance of manual annotation, the pre-defined news text dataset is divided into an annotated text example pool and an unannotated text dataset.

[0006] The news text dataset is converted into embedding vectors. Using a pre-defined large model, the unlabeled text dataset is initially labeled based on the semantic similarity between the first embedding vector corresponding to the labeled text example pool and the second embedding vector corresponding to the unlabeled text dataset, thus obtaining a weakly labeled text dataset.

[0007] Based on cross-entropy loss and Gaussian mixture model, target confidence samples are filtered from the weakly labeled text dataset, and a target sample set with target pseudo-labels is generated based on the target confidence samples through a preset filtering strategy.

[0008] The text to be refined in the weakly labeled text dataset that is not included in the target sample set is identified. Semantic nearest neighbor samples of the text to be refined are retrieved from the labeled text example pool. A dialogue prompt template is constructed based on the semantic nearest neighbor samples. Based on the preset macBERT model, the refined pseudo-labels corresponding to the weakly labeled text dataset are output through the dialogue prompt template.

[0009] The target sample set and the text to be refined are used as training sets and input into the macBERT model for training to obtain a trained text classification model. The core guidance labels of the news to be labeled are then output through the text classification model.

[0010] In one implementation of this application, the unlabeled text dataset is initially labeled based on the semantic similarity between the first embedding vector corresponding to the labeled text example pool and the second embedding vector corresponding to the unlabeled text dataset, to obtain a weakly labeled text dataset, specifically including:

[0011] Calculate the semantic similarity between the first embedding vector corresponding to the labeled text example pool and the second embedding vector corresponding to the unlabeled text dataset;

[0012] According to the descending order of the semantic similarity, a preset number of similar text examples that are semantically similar to the unlabeled text dataset are selected from the labeled text example pool;

[0013] The manually annotated core guides corresponding to the text examples are associated with the similar text examples to construct contextual prompts;

[0014] Using a pre-defined large model and based on the contextual prompts, the unlabeled text dataset is initially labeled to obtain a weakly labeled text dataset.

[0015] In one implementation of this application, target confidence samples are selected from the weakly labeled text dataset based on cross-entropy loss and Gaussian mixture model, specifically including:

[0016] Based on the preset cross-entropy loss function, the loss value corresponding to each sample in the weakly labeled text dataset is calculated, and samples with corresponding loss values ​​less than a preset threshold are selected from the weakly labeled text dataset as candidate target confidence samples.

[0017] The loss values ​​of the candidate target confidence samples are modeled using a Gaussian mixture model, so that the samples corresponding to the low-mean Gaussian components with lower mean in each Gaussian distribution are used as target confidence samples.

[0018] In one implementation of this application, after using the samples corresponding to the low-mean Gaussian components with lower mean values ​​in each Gaussian distribution as target confidence samples, the method further includes:

[0019] Two random samples are selected from the target confidence samples, and the embedding vectors and pseudo-labels corresponding to the random samples are linearly mixed to obtain the target confidence samples with added perturbation samples.

[0020] Add random perturbation to the target confidence sample with added perturbation sample. For each sample, determine the first version sample and the second version sample corresponding to the sample without adding random perturbation and after adding random perturbation, and minimize the KL divergence between the output probability distributions corresponding to the first version sample and the second version sample.

[0021] Based on the target confidence sample and the target confidence sample with added perturbation samples, the macBERT model is optimized in stages to obtain the optimized macBERT model.

[0022] In one implementation of this application, a target sample set with target pseudo-labels is generated based on the target confidence samples using a preset filtering strategy, specifically including:

[0023] The target confidence samples are divided into several target confidence sample subsets according to the category of their corresponding pseudo-labels;

[0024] For the target confidence sample subset, a clean dataset with corresponding cross-entropy loss values ​​within a preset range is selected;

[0025] The clean dataset is clustered using k-medoids, and the center point of each cluster is selected as a representative sample.

[0026] Based on the representative samples corresponding to each category, a target sample set is constructed. The target sample set is then mixed. Based on the mixed samples and mixed pseudo-labels obtained after mixing, the pseudo-labels of the target confidence samples are optimized to obtain a target sample set with target pseudo-labels.

[0027] In one implementation of this application, the target sample set is mixed, and based on the mixed samples and mixed pseudo-labels, the pseudo-labels of the target confidence samples are optimized to obtain a target sample set with target pseudo-labels, specifically including:

[0028] The target sample set is embedded and mixed using the following formula to obtain the mixed target samples and their corresponding mixed pseudo-labels:

[0029]

[0030]

[0031] in, Indicates mixed target samples, and This represents two random representative samples. and This represents the pseudo-label of the representative sample. Indicates mixed pseudo-tags, Indicates the weighting coefficient;

[0032] Based on the macBERT model, output the initial pseudo-labels corresponding to the mixed target samples;

[0033] Based on the difference between the initial pseudo-label and the mixed pseudo-label, the macBERT model is optimized until the confidence of the initial pseudo-label is greater than the preset confidence, at which point the target pseudo-label corresponding to the target sample set is output.

[0034] In one implementation of this application, a dialogue prompt template is constructed based on the semantic nearest neighbor samples. Then, based on a preset macBERT model, refined pseudo-labels corresponding to the weakly labeled text dataset are output through the dialogue prompt template. Specifically, this includes:

[0035] Based on the text to be refined, the pseudo-labels are assigned to the corresponding semantic nearest neighbor samples, and pseudo-labeled example pairs are generated based on the text examples in the semantic nearest neighbor samples and the pseudo-labels;

[0036] Based on the pseudo-annotation example, a dialogue prompt template is constructed. Based on the preset macBERT model, the refined pseudo-labels corresponding to the weakly labeled text dataset are output through the dialogue prompt template.

[0037] The refined pseudo-tags are mapped to numerical tags. If the numerical tags do not conform to the preset tags, the refined pseudo-tags are determined to be abnormal tags.

[0038] In one implementation of this application, the refined pseudo-labels corresponding to the weakly labeled text dataset are output through the dialogue prompt template, specifically including:

[0039] For the target confidence samples in the weakly labeled text dataset, retain the target pseudo-labels corresponding to the target confidence samples.

[0040] This application embodiment provides a news content core guidance labeling device, the device comprising:

[0041] At least one processor;

[0042] And, a memory communicatively connected to the at least one processor;

[0043] The memory stores instructions that can be executed by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform a news content core guidance annotation method as described above.

[0044] This application provides a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:

[0045] One of the above is a method for labeling the core direction of news content.

[0046] The news content core orientation annotation method proposed in this application can bring the following beneficial effects:

[0047] Employing a collaborative and iterative optimization mechanism using a large model, leveraging its contextual understanding capabilities and multi-task joint modeling, this approach accurately identifies and extracts complex semantic information, ensuring comprehensive and precise annotation of the core message of the news. Through collaborative work between the large model and dynamic distillation, a high-quality core message annotation dataset is generated. After multiple rounds of annotation and optimization, reliable training data is provided for subsequent training and applications, thereby improving the classification performance of the text classification model. Combining dynamic distillation and supervised fine-tuning techniques, the annotation results are continuously iterated and refined, effectively improving the accuracy and consistency of the annotations. Attached Figure Description

[0048] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0049] Figure 1 A flowchart illustrating a manual annotation method provided in an embodiment of this application;

[0050] Figure 2 A flowchart illustrating a news content core guidance annotation method provided in this application embodiment;

[0051] Figure 3 This application provides a schematic diagram of a large model prompt word in an embodiment.

[0052] Figure 4 A schematic diagram of prompt word design for the initial annotation stage of core guidance in news content, provided as an embodiment of this application;

[0053] Figure 5 A flowchart illustrating the initial annotation stage of core news content guidance, provided as an embodiment of this application;

[0054] Figure 6 A flowchart illustrating the core guidance and annotation stage of news content is provided for an embodiment of this application.

[0055] Figure 7 A schematic diagram of prompt word design for the core guidance and annotation stage of news content, provided as an embodiment of this application;

[0056] Figure 8 This is a schematic diagram of the structure of a news content core guidance labeling device provided in an embodiment of this application. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0058] The traditional manual annotation method has the following process: Figure 1 As shown, a labeling plan is developed based on the client's labeling requirements. Then, labelers clean, evaluate, and analyze the data to be labeled, completing the labeling process. After data review, the final labeling results are obtained. However, when dealing with complex scenarios such as broad news content, strong contextual dependence, and implicit and overlapping directional expressions, this approach can easily lead to the accumulation and poor transmission of errors at each stage, making it difficult to guarantee the consistency and accuracy of the overall labeling.

[0059] Currently, research on core orientation annotation in news content mainly focuses on how to utilize advanced technologies such as deep learning and large language models to improve annotation efficiency and accuracy. While traditional data annotation platforms are relatively mature in the field of text annotation, the core orientation in news is often implicitly expressed and relies heavily on context. Traditional manual methods suffer from high costs, low efficiency, and insufficient consistency. In recent years, semi-supervised and self-supervised learning methods, by combining a small amount of labeled data with a large amount of unlabeled data for training, have reduced reliance on manual annotation to some extent, but they still fall short in capturing complex semantic relationships and many-to-many dependencies in news text. Meanwhile, zero-shot and few-shot prompting methods driven by large language models have shown great potential in automated annotation due to their powerful contextual understanding and generation capabilities. However, single techniques are prone to error accumulation in multi-stage tasks and lack unified model collaborative optimization, making it difficult to balance the comprehensiveness and accuracy of annotation.

[0060] From a practical application perspective, traditional news annotation methods are prone to error accumulation at key stages when dealing with diverse, implicit, and overlapping expressions in news reports, resulting in insufficient generalization ability of the overall annotation. Therefore, this application provides a core-oriented news content annotation method that integrates contextual understanding from a large language model with few-shot learning techniques to achieve automatic annotation, thereby effectively improving annotation efficiency and accuracy and overcoming the limitations of traditional multi-stage processes where various stages fail to coordinate and optimize.

[0061] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0062] like Figure 2 As shown in the embodiment of this application, a news content core guidance annotation method is provided, including:

[0063] S201: Based on the text examples carrying manually labeled core guidance, the pre-defined news text dataset is divided into a pool of labeled text examples and a pool of unlabeled text examples.

[0064] News data was collected from news report URLs using web scraping tools, stored locally, and then cleaned. After cleaning, news articles exceeding a set word count threshold were filtered for summarization to reduce text length while retaining key information. Specifically, a local large-scale model was deployed, employing a Prompt keyword project to guide the model in extracting core news content and removing redundant details. The prompt keyword design included... Figure 3 The system provides detailed summarization rules that the assistant must follow, the user inputs the full text of the news article, and the output, which is the assistant's output, generates a summary text. Taking the extraction of core planning guidance from news text as an example, the prompt word design needs to retain information related to the core guidance of the news, such as keywords like "development" and "innovation."

[0065] The above process extracts key information from the news using a large model and removes irrelevant content based on prompts to obtain a news text summary. Next, based on predefined news content orientations, several different dimensions are determined, such as "international cooperation," "science and technology," and "innovation-driven," and then the news text is manually labeled with example data, validation data, and test data. Text examples carrying the core orientations of the manual annotations are selected from the news dataset and manually categorized to serve as reference samples for subsequent automatic annotation. Furthermore, based on whether the data carries text annotations, the predefined news text dataset is divided into an labeled text example pool and an unlabeled text dataset.

[0066] S202: Convert the news text dataset into embedding vectors. Using a pre-defined large model, perform preliminary annotation on the unlabeled text dataset based on the semantic similarity between the first embedding vector corresponding to the labeled text example pool and the second embedding vector corresponding to the unlabeled text dataset, to obtain a weakly labeled text dataset.

[0067] Loading Tokenize and a pre-trained language model (Bidirectional Encoder Representations from Transformers, BERT) transforms the news text dataset into embedding vectors, providing high-quality input data for subsequent similarity calculations and classification tasks. The embedding vectors include a first embedding vector corresponding to the labeled text example pool and a second embedding vector corresponding to the unlabeled text dataset. After obtaining the embedding vectors, the pre-defined large model Qwen is used to perform preliminary annotation on the unlabeled text dataset based on the semantic similarity between the first embedding vector corresponding to the labeled text example pool and the second embedding vector corresponding to the unlabeled text dataset, resulting in a weakly labeled text dataset.

[0068] Specifically, based on the Chinese BERT model, the unlabeled text dataset is mapped into 768-dimensional embedding vectors, representing the deep semantic information of the text through a high-dimensional semantic space. Its specific form is as follows:

[0069]

[0070] in, Here, d represents the embedding dimension, and the encoder function is used. This process leverages BERT's Transformer encoder to capture text context features, providing a structured vector representation for subsequent similarity matching. Similarly, the first embedding vector of the labeled text example pool can also be obtained in this way.

[0071] The second embedding vector from the unlabeled text dataset is compared with the first embedding vector from the labeled text example pool. Cosine similarity is used to reflect the semantic similarity between the two; a higher cosine similarity indicates higher semantic similarity. Labeled text examples construct contextual references through labels and semantic associations, providing high-quality prior knowledge for label inference.

[0072] Semantic similarity can be calculated using the following formula:

[0073]

[0074] Where t represents the unlabeled text dataset, This represents the i-th text example. Represents the second embedding vector. This represents the first embedding vector corresponding to the i-th text example.

[0075] After calculating the semantic similarity between the unlabeled text dataset and each labeled text example, K similar text examples that are semantically similar to the unlabeled text dataset are selected from the labeled text example pool in descending order of semantic similarity. This preset number is typically 5-10. After selecting the text examples with the highest matching scores, the manually labeled tags corresponding to these text examples are associated with the similar text examples. Contextual prompts are constructed based on a multi-turn dialogue template, and combined with predefined news content guidance, a context learning framework is built. The multi-turn dialogue template is as follows: Figure 4 As shown, by utilizing the reasoning capabilities of the pre-defined large model Qwen, preliminary pseudo-labels are generated based on contextual cues and the semantic relationship between manually labeled tags and the text to be labeled, thus obtaining a weakly labeled text dataset with preliminary pseudo-labels.

[0076] like Figure 5 The diagram illustrates a process for the initial annotation stage of news content core guidance. Using BERT, the output unlabeled text dataset and the labeled text example pool are converted into embedded vector representations. By designing prompt words and semantic similarity calculation, the similarity between the unlabeled text dataset and the labeled text example pool is achieved. Based on the matched similar text examples and context prompts, preliminary pseudo-labels are generated for the unlabeled text dataset, thus obtaining a weakly labeled text dataset.

[0077] S203: Based on cross-entropy loss and Gaussian mixture model, target confidence samples are filtered from weakly labeled text datasets, and a target sample set with target pseudo-labels is generated based on the target confidence samples through a preset filtering strategy.

[0078] The above process achieves preliminary annotation of the unlabeled text dataset. To improve the accuracy of the annotation results, dynamic distillation technology is needed to filter noise and enhance the quality of the preliminary annotation results, thereby generating high-quality news content core guidance annotation data. Dynamic distillation mainly consists of two stages: robust training and example pool construction. Robust training reduces the negative impact of noisy annotations on the model by jointly optimizing sample selection and model training. Example pool construction aims to filter high-quality example pools, providing representative feedback index files for subsequent iterative optimization processes. In the robust training stage, target confidence samples are selected from the weakly labeled text dataset based on the cross-entropy loss model. Target confidence samples refer to samples with high confidence, which can effectively filter out noisy annotations. The Gaussian mixture model is used to divide the samples into reliable and unreliable categories, retaining low-loss samples. In the example pool construction stage, a target sample set with target pseudo-labels is generated based on the target confidence samples using a preset selection strategy, optimizing the label quality.

[0079] In one embodiment, it is assumed that the weakly labeled text data output by the large model is , Let represent the label space of all possible outputs of the large model, and use the cross-entropy loss function to evaluate the loss value of each sample. The cross-entropy loss function is:

[0080]

[0081] Using the cross-entropy loss function described above, the loss value corresponding to each sample in the weakly labeled text dataset can be calculated. Then, samples with corresponding loss values ​​less than a preset threshold are selected from the weakly labeled text dataset as candidate target confidence samples. Filtering samples by loss value can filter out noisy annotations, ensuring the reliability of the training data.

[0082] The filtered labeled data still needs to undergo reliability analysis using a Gaussian mixture model. The Gaussian mixture model models the distribution of the loss values ​​for the candidate target confidence samples, clustering the data into reliable and unreliable samples. The Gaussian mixture model is expressed as:

[0083]

[0084] in, The mixing coefficient, and Let represent the mean and covariance of the k-th Gaussian distribution, respectively, and L represent the loss value. It is a mathematical symbolic representation that follows a Gaussian distribution.

[0085] After fitting the parameters using the expectation-maximization algorithm, the samples corresponding to the low-mean Gaussian components with lower mean values ​​in each Gaussian distribution are used as target confidence samples.

[0086] Furthermore, an embedding-level sample mixing strategy is employed. This involves perturbing and mixing the embedding representations of high-confidence samples to generate new training samples, thereby improving data diversity. Specifically, two random samples are selected from the target confidence samples. and The embedding vectors corresponding to random samples are weighted by averaging. and and its pseudo-labels and The target confidence sample with added perturbation samples is obtained. With pseudo-tags ,in, It follows a uniform distribution The weighting coefficients of the sampling can enhance data diversity and alleviate the problem of sparse annotation by embedding and mixing the sample data.

[0087] Furthermore, by introducing a technique combined with a consistency regularization mechanism, perturbations are applied to the training samples to generate multiple versions, and the output consistency between different versions is calculated. This ensures that the model maintains stable output under different perturbations, a process constrained by KL divergence. Specifically, random perturbations are added to the target confidence samples with perturbations. For each sample, the first version sample corresponding to the sample without random perturbation and with random perturbation is determined. Second version sample And minimize the KL divergence between the output probability distributions corresponding to the first and second version samples. The loss function is specifically expressed as:

[0088]

[0089] in, Denotes KL divergence, This represents the output probability distribution of the first version of the sample. This represents the output probability distribution of the second-version samples. This regularization constraint can improve the robustness of the model when facing unlabeled data and reduce the impact of data uncertainty.

[0090] Furthermore, the text classification model used to generate core navigation annotations in this application is trained based on the macBERT model. During the robust training phase, the macBERT model needs to be optimized in stages based on target confidence samples and target confidence samples with added perturbations, resulting in an optimized macBERT model. The training process consists of two stages: the initial stage uses the full dataset to coarsely learn semantic features; the progressive stage gradually transitions to using only high-confidence samples to avoid noise overfitting. The loss function incorporates cross-entropy loss. Mixed loss With consistency loss The weight coefficients are dynamically adjusted with each training epoch. The loss function is specifically expressed as:

[0091]

[0092] in, , , Updated using an exponential decay strategy.

[0093] The above process completes the robust training of the weak text annotation dataset and selects high-confidence target confidence samples. The next step is to optimize the quality of its pseudo-labels.

[0094] Specifically, for the labeled news core guidance data, the top R% samples with the smallest cross-entropy loss are selected by category. Then, the initial screening samples are clustered in the embedding space, and the class centers are selected as representative examples. Examples from each category are merged to ensure diversity and coverage. Finally, new samples are generated by embedding mixing, and the label quality is optimized by combining multiple rounds of confidence verification.

[0095] In one embodiment, the screening strategy includes two steps: initial screening with low-loss selection and fine screening with k-medoids clustering, and is processed on a category-based basis to ensure that each category is covered and to guarantee diversity.

[0096] First, the target confidence samples are divided into several target confidence sample subsets according to the category of their corresponding pseudo-labels. For the target confidence sample subset, a clean dataset with corresponding cross-entropy loss values ​​within a preset range is selected. During this selection process, samples with smaller cross-entropy loss values ​​are chosen, and the top R% of samples with the smallest losses are also selected proportionally. The small loss criterion ensures high dataset accuracy by selecting the samples with the smallest cross-entropy loss. R is set to a small value to ensure high accuracy for the selected samples.

[0097] Then, the k-medoids clustering algorithm is used to process the embedding representation of the pre-trained model, i.e., the macBERT model, thereby improving its performance. The most representative samples were selected from the data to construct a more representative example dataset. The algorithm divides the data points into k clusters, selects the center point of each cluster as a representative sample, and finally collects these representative samples as... When the k-medoids algorithm converges, the center samples of the k clusters are the representative samples, which are used as high-quality examples for subsequent training and fine-tuning.

[0098] Based on the representative samples corresponding to each category, a target sample set is constructed, specifically as follows:

[0099]

[0100] target sample The collection contains representative samples from all categories, ensuring the diversity and quality of the dataset.

[0101] Finally, based on the cleaned samples, a fusion strategy is embedded to enhance data diversity. That is, the target sample set is fused, and based on the fused samples and fused pseudo-labels, the pseudo-labels of the target confidence samples are optimized, thereby obtaining a target sample set with target pseudo-labels.

[0102] Specifically, the target sample set is embedded and mixed to obtain the mixed target samples and their corresponding mixed pseudo-labels:

[0103]

[0104]

[0105] in, Indicates mixed target samples, and This represents two random representative samples. and This represents a pseudo-label representing a sample. Indicates mixed pseudo-tags, This represents the weighting coefficient.

[0106] Based on the macBERT model, the initial pseudo-labels corresponding to the mixed target samples are output. Then, based on the difference between the initial pseudo-labels and the mixed pseudo-labels, the macBERT model is optimized until the confidence of the initial pseudo-labels is greater than the preset confidence, at which point the target pseudo-labels corresponding to the target sample set are output.

[0107] S204: Identify the texts to be refined in the weakly labeled text dataset that are not included in the target sample set, retrieve the semantic nearest neighbor samples of the texts to be refined from the labeled text example pool, and construct a dialogue prompt template based on the semantic nearest neighbor samples. Based on the preset macBERT model, output the refined pseudo-labels corresponding to the weakly labeled text dataset through the dialogue prompt template.

[0108] After generating pseudo-labels for the weakly labeled text dataset, it is necessary to refine the annotations to improve the accuracy and semantic consistency of the labeled data. First, identify the texts in the weakly labeled text dataset that are not included in the target sample set. Retrieve semantic nearest neighbor samples of the texts to be refined from the labeled text example pool. Construct dialogue prompt templates based on these semantic nearest neighbor samples. Using a pre-defined macBERT model, output the refined pseudo-labels for the weakly labeled text dataset through these dialogue prompt templates. Refining the annotations based on the initial annotation results guided by news core aims to improve the accuracy and semantic consistency of the labeled data. The specific process is as follows: Figure 6 As shown.

[0109] In one embodiment, a sample library for the refining process is constructed based on target pseudo-labels generated during the dynamic distillation process. For the text t to be refined, semantically nearest samples are retrieved from the labeled text sample pool to form a reference sample set. .

[0110] Using pre-computed embedding vectors Retrieve Top-K similar sample index from training data ,satisfy:

[0111]

[0112] in, The cosine similarity function is used. For training set samples The embedding vector.

[0113] Based on the pseudo-tags corresponding to the text to be refined, for each example Assign pseudo-labels to the initial annotations And based on the text examples and their corresponding pseudo-tags, construct pseudo-annotation example pairs. .

[0114] The design of prompts in the core guidance and annotation stage of news content, such as... Figure 7 As shown, the semantic understanding capability of the model is enhanced through structured context injection. The feedback results of dynamic distillation are used together with the text to be labeled to construct a dialogue prompt template. That is, a dialogue prompt template is constructed based on pseudo-labeled examples, guiding the macBERT model to generate more accurate and refined pseudo-labels in semantically related scenarios. Each example and its pseudo-label are converted into a "user-assistant" dialogue pair, forming a learning paradigm for labeling rules. The classification dimension definition and output constraints are clearly defined in the prompts, limiting the selection to only preset dimensions, thereby strengthening the model's understanding and adherence to the rules.

[0115] A dual calibration strategy is designed for the refined results to balance annotation correction and stability. Therefore, after generating refined pseudo-labels, the labels need to be mapped and anomaly handled. Specifically, the refined pseudo-labels of the Chinese dimensions output by the model are mapped to numerical labels. If the numerical labels do not conform to the preset labels, the refined pseudo-labels are identified as anomalous labels and marked accordingly. .

[0116] It should be noted that when refining and optimizing pseudo-labels, it is necessary to protect the target confidence samples with high confidence. In other words, if a sample belongs to the target confidence sample, its initial pseudo-label should be retained for such high-quality sample sets to avoid erroneous correction of reliable labels.

[0117] S205: Input the target sample set and the text to be refined as the training set into the macBERT model for training, obtain the trained text classification model, and output the core guidance label of the news to be labeled through the text classification model.

[0118] The above steps, through the synergy of semantic embedding, dynamic distillation, and iterative optimization, achieve efficient and accurate annotation of the core orientation of news texts. Based on the high-quality news core orientation annotation data generated by iterative annotation, namely the target sample set and the text to be refined, the Chinese pre-trained model macBERT is used to conduct supervised training on the dataset. Combined with techniques such as data augmentation, model optimization, adversarial training, and learning rate scheduling, a trained text classification model is obtained. Thus, the core orientation of each news article can be determined through the text classification model.

[0119] First, the text data is cleaned and enhanced to improve the model's adaptability to different types of input. In addition to standard cleaning operations such as removing stop words and punctuation, simplified / traditional character conversion and synonym replacement techniques are introduced to enrich the diversity of the training data. Using the OpenCC tool, the text is randomly converted between simplified and traditional Chinese to enhance the model's adaptability to multiple language forms.

[0120] A thesaurus is generated based on the Word2Vec model. For each word, the similarity between its word vector and other words is calculated, and the most similar synonyms are selected according to the set similarity threshold.

[0121] Secondly, additional classification layers are added, including fully connected layers, ReLU activation function, and LayerNorm, to enhance the model's expressive power and classification accuracy, addressing task complexity and data class imbalance. Focal Loss is used as the loss function. Focal Loss adjusts the weights of easy and difficult samples, causing the model to focus more on difficult-to-classify samples during training. Its implementation is as follows:

[0122]

[0123] in, The probability predicted by the model. For category weights, To adjust the parameters.

[0124] Then, to enhance the model's robustness and generalization ability in text classification tasks, the gradient of the embedding layer is calculated, and adversarial examples are generated by adding perturbations based on the gradient direction. The model calculates the loss on both the original and adversarial samples and updates the parameters through double backpropagation. In each training step, the loss for the current batch is first calculated and backpropagation is performed to obtain the gradient information of the embedding layer. Subsequently, small perturbations are added based on the gradient direction to generate adversarial examples. The model calculates the loss on both the original and adversarial samples and updates the parameters through double backpropagation. In this way, the model can learn feature representations that are insensitive to input perturbations, thereby effectively mitigating the overfitting problem and maintaining high accuracy and stability when facing noisy data. In each training step, adversarial examples are generated by adding gradient-based perturbations to the embedding layer, enabling the model to maintain good classification performance even when facing slight perturbations.

[0125] Finally, the training process uses the AdamW optimizer, combined with a cosine annealing learning rate scheduler to dynamically adjust the learning rate, ensuring smooth model convergence. An early stopping mechanism is introduced: training is terminated prematurely if the validation set accuracy fails to improve over several consecutive epochs, thus preventing overfitting.

[0126] By combining the above technologies, a text classification model that can accurately identify the core direction of news is finally obtained, realizing the transformation from high-quality labeled data to an efficient classifier.

[0127] The above are embodiments of the methods proposed in this application. Based on the same idea, some embodiments of this application also provide devices and non-volatile computer storage media corresponding to the above methods.

[0128] Figure 8 This is a structural schematic diagram of a news content core guidance labeling device provided in an embodiment of this application. For example... Figure 8 As shown, it includes:

[0129] At least one processor; and,

[0130] At least one processor-communication-connected memory; wherein,

[0131] The memory stores instructions that can be executed by at least one processor, such that the at least one processor can perform a news content core guidance annotation method as described above.

[0132] This application provides a non-volatile computer storage medium storing computer-executable instructions, which are configured to execute a news content core guidance annotation method as described in any of the preceding claims.

[0133] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and medium embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the description of the method embodiments.

[0134] The devices and media provided in this application are one-to-one with the methods. Therefore, the devices and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.

[0135] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0136] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0137] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0138] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0139] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0140] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0141] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0142] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0143] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of this application should be included within the scope of the claims of this application.

Claims

1. A method for labeling the core direction of news content, characterized in that, The method includes: Based on the text examples carrying the core guidance of manual annotation, the pre-defined news text dataset is divided into an annotated text example pool and an unannotated text dataset. The news text dataset is converted into embedding vectors. Using a pre-defined large model, the unlabeled text dataset is initially labeled based on the semantic similarity between the first embedding vector corresponding to the labeled text example pool and the second embedding vector corresponding to the unlabeled text dataset, thus obtaining a weakly labeled text dataset. Based on cross-entropy loss and Gaussian mixture model, target confidence samples are filtered from the weakly labeled text dataset, and a target sample set with target pseudo-labels is generated based on the target confidence samples through a preset filtering strategy. The text to be refined in the weakly labeled text dataset that is not included in the target sample set is identified. Semantic nearest neighbor samples of the text to be refined are retrieved from the labeled text example pool. A dialogue prompt template is constructed based on the semantic nearest neighbor samples. Based on the preset macBERT model, the refined pseudo-labels corresponding to the weakly labeled text dataset are output through the dialogue prompt template. The target sample set and the text to be refined are used as training sets and input into the macBERT model for training to obtain a trained text classification model. The core guidance label of the news to be labeled is then output through the text classification model. Using a preset filtering strategy, a target sample set with target pseudo-labels is generated based on the target confidence samples, specifically including: The target confidence samples are divided into several target confidence sample subsets according to the category of their corresponding pseudo-labels; For the target confidence sample subset, a clean dataset with corresponding cross-entropy loss values ​​within a preset range is selected; The clean dataset is clustered using k-medoids, and the center point of each cluster is selected as a representative sample. Based on the representative samples corresponding to each category, a target sample set is constructed. The target sample set is then mixed. Based on the mixed samples and mixed pseudo-labels obtained after mixing, the pseudo-labels of the target confidence samples are optimized to obtain a target sample set with target pseudo-labels.

2. The news content core guidance annotation method according to claim 1, characterized in that, Based on the semantic similarity between the first embedding vector corresponding to the labeled text example pool and the second embedding vector corresponding to the unlabeled text dataset, the unlabeled text dataset is initially labeled to obtain a weakly labeled text dataset, specifically including: Calculate the semantic similarity between the first embedding vector corresponding to the labeled text example pool and the second embedding vector corresponding to the unlabeled text dataset; According to the descending order of the semantic similarity, a preset number of similar text examples that are semantically similar to the unlabeled text dataset are selected from the labeled text example pool; The manually annotated core guides corresponding to the text examples are associated with the similar text examples to construct contextual prompts; Using a pre-defined large model and based on the contextual prompts, the unlabeled text dataset is initially labeled to obtain a weakly labeled text dataset.

3. The news content core guidance annotation method according to claim 1, characterized in that, Based on cross-entropy loss and Gaussian mixture model, target confidence samples are selected from the weakly labeled text dataset, specifically including: Based on the preset cross-entropy loss function, the loss value corresponding to each sample in the weakly labeled text dataset is calculated, and samples with corresponding loss values ​​less than a preset threshold are selected from the weakly labeled text dataset as candidate target confidence samples. The loss values ​​of the candidate target confidence samples are modeled using a Gaussian mixture model, so that the samples corresponding to the low-mean Gaussian components in each Gaussian distribution are used as target confidence samples.

4. The news content core guidance annotation method according to claim 3, characterized in that, After using the samples corresponding to the low-mean Gaussian components in each Gaussian distribution as target confidence samples, the method further includes: Two random samples are selected from the target confidence samples, and the embedding vectors and pseudo-labels corresponding to the random samples are linearly mixed to obtain the target confidence samples with added perturbation samples. Add random perturbation to the target confidence sample with added perturbation sample. For each sample, determine the first version sample and the second version sample corresponding to the sample without adding random perturbation and after adding random perturbation, and minimize the KL divergence between the output probability distributions corresponding to the first version sample and the second version sample. Based on the target confidence sample and the target confidence sample with added perturbation samples, the macBERT model is optimized in stages to obtain the optimized macBERT model.

5. The news content core guidance annotation method according to claim 1, characterized in that, The target sample set is fused, and based on the fused samples and fused pseudo-labels, the pseudo-labels of the target confidence samples are optimized to obtain a target sample set with target pseudo-labels, specifically including: The target sample set is embedded and mixed using the following formula to obtain the mixed target samples and their corresponding mixed pseudo-labels: in, Indicates mixed target samples, and This represents two random representative samples. and This represents the pseudo-label of the representative sample. Indicates mixed pseudo-tags, Indicates the weighting coefficient; Based on the macBERT model, output the initial pseudo-labels corresponding to the mixed target samples; Based on the difference between the initial pseudo-label and the mixed pseudo-label, the macBERT model is optimized until the confidence of the initial pseudo-label is greater than the preset confidence, at which point the target pseudo-label corresponding to the target sample set is output.

6. The news content core guidance annotation method according to claim 1, characterized in that, Based on the semantic nearest neighbor samples, a dialogue prompt template is constructed. Using a pre-defined macBERT model, refined pseudo-labels corresponding to the weakly labeled text dataset are output through the dialogue prompt template, specifically including: Based on the text to be refined, the pseudo-labels are assigned to the corresponding semantic nearest neighbor samples, and pseudo-labeled example pairs are generated based on the text examples in the semantic nearest neighbor samples and the pseudo-labels; Based on the pseudo-annotation example, a dialogue prompt template is constructed. Based on the preset macBERT model, the refined pseudo-labels corresponding to the weakly labeled text dataset are output through the dialogue prompt template. The refined pseudo-tags are mapped to numerical tags. If the numerical tags do not conform to the preset tags, the refined pseudo-tags are determined to be abnormal tags.

7. The news content core guidance annotation method according to claim 6, characterized in that, Using the dialogue prompt template, refined pseudo-labels corresponding to the weakly labeled text dataset are output, specifically including: For the target confidence samples in the weakly labeled text dataset, retain the target pseudo-labels corresponding to the target confidence samples.

8. A news content core guidance labeling device, characterized in that, The device includes: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform a news content core guidance annotation method as described in any one of claims 1-7.

9. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are set as follows: A method for labeling the core direction of news content as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Image classification method, system and device based on active domain self-adaption and medium

    CN116630708A

  • Weak supervision text classification method and system based on prompt project

    CN117932073A