News standard term detection and correction method based on large language model

Through the generator-detector collaborative training architecture and data preprocessing, the misjudgment problem in the standard detection of news languages is solved, high-precision detection and correction of news languages is achieved, and the efficiency and accuracy of news editors are improved.

CN120493901APending Publication Date: 2025-08-15EAST CHINA NORMAL UNIV +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510630731.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-16
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing technology cannot effectively understand the context semantics of news releases, resulting in misjudgment and over-censorship of standard detection and correction of news language specifications. The existing CSC and CGEC models are insufficient in the field of news, which cannot meet the high accuracy requirements of news language specifications.

Method used

The generator-detector collaborative training architecture is adopted, and the Qwen2.5-7B-Instruct model is used as the generator, and the detector module is used to finely screen the hidden vectors, and the detection and correction methods of news specification terms are constructed, and the model performance is optimized through data preprocessing and multi-task learning.

Benefits of technology

It significantly reduces the missed detection and misjudgment rate of news language detection and correction, improves the accuracy and efficiency of news language standardization, realizes token-level fine-grained annotation and rewriting, and improves the work efficiency of news editors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120493901A_ABST
    Figure CN120493901A_ABST
Patent Text Reader

Abstract

The invention discloses a news standard term detection and correction method based on a large language model, which is characterized in that a generator-detector cooperative training architecture is adopted, a Qwen2.5-7B-Instruct model is used as a generator, a detector module is assisted to finely screen implicit vectors, the generator is guided to avoid excessive sensitivity and false change, and the accuracy of the news standard term detection and correction is improved. And the problem of news expression deformity caused by improper use of words, nonstandard language expression and noun errors in the news manuscript is effectively solved. Compared with the prior art, the method has the advantage that the problem of news expression deformity caused by improper use of words, nonstandard language expression and political noun errors in news manuscripts is solved. Experimental results show that the method obtains an ideal F0.5 index on the news term correction task, and shows that the large language model has a wide application prospect in the fields of text quality control and intelligent editing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a method for detecting and correcting standard news terms based on a large language model. Background Art

[0002] Journalists are not only responsible for the authenticity and guidance of news articles, but also have an obligation to correctly use and disseminate the spoken and written language of their motherland. Adherence to standard journalistic language helps enhance the credibility of news media and provide reliable information to the public. Standardized news language also guides the public in using correct language and supports the healthy development of the Chinese language. However, in today's information explosion, journalists face the dual challenges of time pressure and the complexity of information sources, often neglecting to review news articles for compliance. Furthermore, the shift to online media has resulted in fewer media personnel and a multitude of platforms, leading to a perfunctory review process.

[0003] Current automated solutions often rely on word libraries and regular expression matching. While these solutions can address some obvious errors, they rely heavily on static word lists and struggle to understand contextual semantics. Consequently, they can overlook text context and overly strict censorship, leading to inaccurate results. Artificial intelligence technologies, such as large language models (LLMs), offer a new approach to addressing this pain point. These models can learn contextual information from large corpora and achieve flexible and accurate word usage detection based on deep semantic understanding.

[0004] Advances in artificial intelligence technology, represented by large language models (LLMs), offer new insights into addressing this vulnerability. Large language models can fully leverage contextual information to achieve more flexible and accurate detection of standard news terms while understanding semantics. From the nature of the task, standard news terminology correction overlaps with Chinese spelling correction (CSC) and Chinese grammatical error correction (CGEC): misuse of words and syntactical errors can draw on the technical framework of CSC / CGEC; however, news scenarios place far greater demands on the basic elements of manuscripts and political nouns than general text, and place a high emphasis on political compliance. Therefore, standard news terminology detection should be viewed as a specialized extension of CSC and CGEC in the news field, integrating the contextual modeling capabilities of LLMs with domain knowledge bases and fine-grained labeling systems.

[0005] In summary, the existing technology has the following deficiencies and problems:

[0006] 1) Rule-based manual recognition cannot understand contextual information and is prone to misjudgment

[0007] Most current automated proofreading solutions are based on the traditional technical framework of "lexicon + regular rules": engineers first compile common typos, banned words, political terms, etc. into a static lexicon, and then search each one using pattern matching. This method can quickly capture obvious, enumerable text errors and is particularly suitable for eliminating low-level errors in fixed formats. However, its core relies on simple comparisons at the "string level" and lacks a holistic understanding of syntactic structure and text semantics. The rules are too rigid and can easily lead to "over-censorship." Once a word is marked as "high-risk" in the lexicon, regardless of whether it is a real quotation, a negative usage, or an academic explanation in the sentence, the system will reject it across the board, forcing editors to repeatedly manually approve it, which in turn reduces work efficiency. Overall, the lexicon-regular model can still work when dealing with texts with simple structures and a single type of error. However, in real scenarios such as press releases, which have complex semantics, high political sensitivity, and the need to maintain consistency, it exposes "weaknesses" such as ignoring context, unbalanced review intensity, and difficulty in ensuring accuracy. There is an urgent need to introduce higher-level intelligent technologies that can understand semantic logic and dynamically update knowledge.

[0008] 2) Models based on CSC and CGEC are not fully compatible with the task of detecting and correcting standard news terms.

[0009] In the fields of CSC and CGEC, the potential of LLM has yet to be fully explored. Currently, BERT and its derivative BART model remain the state-of-the-art models in these two fields. An attempt was made to transfer the BART-based Alirector, a state-of-the-art model in the CGEC field, to the task of news text normalization. However, experimental results show that Alirector is not well suited for the task of correcting standard news terms. Compared to simple supervised fine-tuning training, Alirector exhibits more severe overcorrection. This phenomenon indicates that Alirector faces transfer challenges when applied to different domains, and the model's alignment mechanism requires further optimization. This performance is related to the characteristics of news standardization datasets. Basic elements and certain words in news articles are easily confused with everyday terms. The Alirector model, based on research in the CSC and CGEC fields, is unable to effectively learn these characteristics of news standardization tasks, resulting in significant misclassifications. Summary of the Invention

[0010] The purpose of the present invention is to provide a method for detecting and correcting news standard terms based on a large language model in response to the deficiencies of the existing technology. The method adopts a generator-detector collaborative training architecture, uses the Qwen2.5-7B-Instruct model as a generator, and uses a detector module to finely screen the latent vector, thereby guiding the generator to avoid oversensitivity and erroneous corrections, effectively solving the problem of news terminology deviation caused by improper use of words, non-standard language expression, and noun errors in news articles. The method is based on the theory and practice of a large language model. First, supervised data of news standard terms is obtained through data preprocessing. Then, the data is used to conduct in-depth analysis and experiments on various Chinese grammar error correction models, pointing out their deficiencies in adapting to the task of correcting news standard terms, thereby effectively solving the problem of news terminology deviation caused by improper use of words, non-standard language expression, and noun errors in news articles. Experimental results show that this method significantly reduces the cost of manual labeling, improves the detection and correction of standardized news terms, and achieves an ideal F0.5 index in the task of correcting news terms, indicating that large language models have broad application prospects in the fields of text quality control and intelligent editing.

[0011] The specific technical solution for achieving the purpose of the present invention is: a method for detecting and correcting standard news terms based on a large language model. The method is characterized by adopting a generator-detector collaborative training architecture, using the Qwen2.5-7B-Instruct model as a generator, and supplemented by a detector module to finely screen latent vectors. The method includes the following steps:

[0012] Step 1: Build data for detecting and generating news standard terms

[0013] Nonstandard terminology in news releases includes the following: inaccurate or inappropriate word usage, and language preprocessing to ensure data quality and consistency. The input consists of the task instructions plus a piece of news text excerpted from a news release. The output of the generated data is the altered text. The output of the detection data is constructed based on the sequence labeling task, which assigns a 0 / 1 label to each token in the input text.

[0014] Step 2: Build a detector and generator collaborative training framework

[0015] Based on the fine-tuning of the basic generation task, a detector module is added to build a new collaborative training framework. The two tasks of detecting and correcting standard news terms are placed in the self-created training framework for multi-task learning and collaborative training, so that the trained model has the ability to detect and correct at the same time.

[0016] Step 3: Divide the training data into initialization set, training set and validation set.

[0017] Step 4: Detector module initialization

[0018] In order to ensure that the detector module has a certain basic detection capability and to enhance the stability of the training, the present invention first performs initialization training on the detector module using the initialization set in step 3.

[0019] Step 5: Use the training set obtained in step 3 to fine-tune the parameters of the Alibaba Cloud open-source large model Qwen-7B-Instruct through low-rank adaptation LoRA.

[0020] Step 6: After fine-tuning the training in Step 5, we obtain a large expert model for detecting and correcting standard news terms. This expert model is deployed as a service using Flask. Detection and correction can be decoupled during deployment, allowing users to choose a faster detection service or a complete service with both detection and correction capabilities.

[0021] The data preprocessing in step 1 specifically includes:

[0022] 1.1: Contextual completion

[0023] For some fragmented contexts in the original news non-standard text data, a large language model is used to implement semantic automatic completion of the context while retaining the original sentence.

[0024] 1.2: Build generated data

[0025] For existing non-standard news texts, we replace non-standard terms with standard terms based on the non-standard vocabulary to construct an equivalent amount of standard text. We then concatenate the model instructions, input text, and output text using Qianwen's generated templates to construct training data suitable for fine-tuning.

[0026] 1.3: Constructing token-level detection label data

[0027] The detection task can be viewed as a sequence labeling task for a sequence of tokens in an input text. The input text is tokenized using Tongyi Qianwen's tokenizer, and the offsets between tokens and words are recorded. Non-standard words are matched against a non-standard vocabulary. The corresponding tokens are marked as 1 based on the query offset, and the remaining tokens are marked as 0, resulting in the labeled sequence for the input text.

[0028] The training framework in step 2 includes two parts: model architecture and training architecture, specifically including:

[0029] 2.1: Model Architecture

[0030] The model architecture is mainly divided into two parts: generator and detector:

[0031] 2.1.1: Generator

[0032] The generator part follows the generation header of Tongyi Qianwen;

[0033] 2.1.2: Detector

[0034] The detection head consists of a bidirectional LSTM and an MLP layer. For the training data, the Qianwen model calculates the latent vector. The detection head then performs a 0 / 1 classification on each latent vector corresponding to the input, ultimately generating a 0 / 1 sequence of length equal to the input.

[0035] 2.2: Training Architecture

[0036] For self-built training frameworks, the loss function calculation needs to be reconstructed during the training phase. The loss function calculation for training needs to include the following two losses for generation tasks and detection tasks:

[0037] 2.2.1: Loss of the Generation Task

[0038] The common cross entropy loss is used as the loss function for the generation task;

[0039] 2.2.2: Loss of detection task

[0040] Since the distribution of 0 / 1 samples in the detection task is quite different, the weighted cross entropy loss function is used as the loss function of the detection task to alleviate the impact of 0 / 1 data imbalance on the detection task training;

[0041] 2.2.3: Combining the two task losses

[0042] Since the data scales of the two losses are inconsistent, a hyperparameter alpha is added to the detection task to bring the data scales of the two losses closer and prevent the loss of one task from dominating the training.

[0043] The training data division in step 3 specifically includes:

[0044] 3.1: The training data is divided into a set to be divided and a verification set at a ratio of 4:1, and the set to be divided into an initialization set and a training set at a ratio of 4:1. The initialization set is used for initialization training of the detector module (detection head) so that it has preliminary detection capabilities.

[0045] The detector module initialization in step 4 specifically includes:

[0046] 4.1: In the initialization stage, freeze all parameters of the thousand-question model and the generation head. Only the detection head parameters can be trained and updated. Use the initialization set in step 3 to initialize the detection head at a larger learning rate.

[0047] The step 5 specifically includes:

[0048] 5.1: Write a LoRA fine-tuning script based on the open source code library peft and transformers, specifying fine-tuning parameters such as rank r, weight alpha, epoch, batch, etc.

[0049] 5.2: Load the Qwen2.5-7B model based on the transformer library;

[0050] 5.3: Load the training data and Qwen2.5-7B-Instruct model into the GPU and run the fine-tuning script to perform efficient parameter fine-tuning PEFT.

[0051] The decoupling and deployment in step 6 specifically include:

[0052] 6.1: Decoupling

[0053] In step 5, the parameters of the LoRA adapter and the detection head are obtained through training. The LoRA adapter is combined with the Qwen2.5-7B-Instruct to form an expert model. Simply inputting the text into this expert model will produce the corrected news language. This expert model calculates the latent vector for the input text and inputs the resulting latent vector into the detection head to obtain the detection results. The correction and detection functions can be directly decoupled and used independently.

[0054] 6.2: Deployment

[0055] The open source library flask is used to serve the expert model, and the word segmenter is used for post-processing to mark the words detected as non-standard and the corresponding corrected words.

[0056] Compared with the prior art, the present invention has the following beneficial technical effects and significant technical progress:

[0057] 1) Introducing contextual understanding: Traditional regular expression matching relies on a static vocabulary and cannot distinguish between conformance and nonconformance due to contextual changes in word meaning. This solution, based on the Qwen Decoder-Only architecture, fully integrates contextual information during autoregressive inference. This approach can understand sentence meaning and paragraph logic, thereby determining whether the same word conforms to news terminology standards in different contexts, significantly reducing missed detections and misjudgments.

[0058] 2) Achieve the coordination of detection and correction dual tasks: Through the collaborative architecture that shares the latent vector between the generator and the detector, the detection task and the correction task are jointly optimized within the same semantic space. The detector accurately marks the non-standard tokens and provides real-time "error correction signals" for the generator. While correcting the text, the generator feeds back to the detector to update the discrimination boundary. Compared with traditional CGEC models that can only output sentence-level or fragment-level results, this design achieves fine-grained annotation and rewriting at the token level, retaining the compliant content of the original text while avoiding overcorrection.

[0059] 3) Improve training efficiency and model performance: This solution only adds a lightweight detection head on top of Qwen and adopts two-stage joint loss training. The overall process is simple, and end-to-end optimization can be completed without additional burden. At the same time, the Decoder-Only architecture has the advantages of parameter utilization rate and inference speed, enabling the model to maintain friendly deployment while significantly improving performance, providing the ability of "faster, more accurate, and more stable" language norm review for news editing scenarios. Brief Description of the Drawings

[0060] Figure 1 It is the collaborative training architecture diagram of the generator-detector;

[0061] Figure 2 It is the performance comparison diagram of the large model of the present invention and other models;

[0062] Figure 3 It is the change curve diagram of the detector accuracy rate, F1 value and the generator loss. Detailed Implementation Manner

[0063] The present invention will be described in detail below with reference to the accompanying drawings.

[0064] Refer to Figure 1 , the present invention specifically includes:

[0065] 1) Data construction

[0066] 1-1: News non-standard language data

[0067] Definition: Classify the errors caused by the non-standard use of news language into the following four categories according to the manifestation forms: inaccurate or inappropriate use of words, inappropriate use of language, non-standard use of basic elements of the manuscript, and non-standard use of political terms.

[0068] For example: Missing words, misspelled words, and wrong characters often appear in news manuscripts, which belong to inaccurate or inappropriate use of words; in inappropriate contexts, misusing "lifelong" as "lifetime" or mixing "de", "di", and "de", which belong to inappropriate use of language; incorrect names of people, places, units, time, etc. appear, which belong to non-standard use of basic elements of the manuscript.

[0069] 1-2: Contextual completion

[0070] An inspection of the data revealed that some data had fragmented context and incomplete words and sentences. To prevent such problems from affecting the model's understanding of news irregularities, a pre-processing module for context completion was introduced to improve data quality before manually constructing the training data. For data with fragmented context, the irregular characters are first obtained through matching, and then prompt words are constructed: the large language model is required to generate a complete and coherent new draft with the same theme and news reporting style, while retaining the original sentence and ensuring that the specified irregular characters are still included. The model automatically fills in the background, details, and conclusions before and after the original sentence, so that the fragmented sentences fit into the complete context. At the same time, because the prompts provide the correct way to write them, typos are avoided by mistake. The entire process achieves semantic-level automatic completion and batch data enhancement for fragmented news sentences, and can be directly used for training for typo detection and correction tasks.

[0071] 1-3: Training data construction

[0072] See Figure 1 , the present invention adopts a generator-detector collaborative training architecture, and the training data of the generation task is constructed in the form of instruction+input+ouput, where the instruction of each data is the same, and the input and output vary.

[0073] 2) Detector and generator collaborative training framework

[0074] 2-1: Model Architecture

[0075] See Figure 1 In this detector-generator joint framework, the generator part uses Qwen-2.5-7B-Instruct as the base, loaded into the GPU with 4-bit quantization (load_in_4bit=True, bnb_4bit_compute_dtype=float16), and then encapsulated with LoRA low-rank adaptation (LoraConfig(r=8, lora_alpha=16,lora_dropout=0.05, bias="none", task_type="CAUSAL_LM")), and then enabled gradient_checkpointing and model.enable_input_require_grads() to limit the trainable weights to the LoRA layer, ensuring that the large model inference memory is controllable and still fine-tunable; in the forward pass of the generator, in addition to the regular logits and loss, hidden_states are also returned.

[0076] The detector uses a custom PyTorch model architecture, with a detection head attached to the Qwen output. The final hidden vector is first fed into a bidirectional LSTM, then into a Swiglu activation layer, and then a linear layer outputs mlp_logits. Due to the autoregressive nature of the Qwen model, the generated hidden vector only considers the contextual information. Therefore, a bidirectional LSTM is introduced to supplement this contextual information. To ensure consistency with the Qianwen model, the detection head uses the same Swiglu activation function as the Qianwen model.

[0077] 2-2: Training Architecture

[0078] The training architecture defines a custom CustomTrainer class that inherits from Trainer. The training process first calls the parent class to calculate Qwen's generator loss, original_loss. Then, based on a fixed prompt length, it dynamically constructs a valid_mask to obtain the hidden_states corresponding to a batch of unequal-length inputs in the training data. Weighted cross-entropy is calculated to obtain the detection loss, custom_loss. Finally, generation and detection are jointly optimized using the formula total_loss = original_loss + 0.1 × custom_loss. During training, Qwen continues to learn the language modeling objective of "generating correct sentences," while the detection head simultaneously learns the classification objective of "identifying incorrect words token by token." This achieves integrated generation-detection collaboration. The inference phase outputs both the corrected text and the error label for each token, meeting dual-task requirements.

[0079] 3) Expert large model fine-tuning training

[0080] After data integration, this paper combines LoRA, an efficient parameter fine-tuning technology, to improve the performance and adaptability of large language models for specific tasks. LoRA fine-tuning enables efficient downstream task adaptation while maintaining a low parameter count, thereby improving the platform's flexibility and efficiency.

[0081] 3-1: LoRA fine-tuning

[0082] LoRA fine-tuning injects the knowledge of the fine-tuning dataset through two trainable low-rank matrices A and B. The number of LoRA parameters is typically only 0.8%-1.5% of the number of pre-trained model parameters. Compared with full fine-tuning, this greatly saves the storage space occupied by the pre-trained model. For subsequent new tasks, developers only need to annotate a small amount of data to fine-tune the corresponding tasks, and during deployment, they only need to replace the LoRA parameters to adapt to the new tasks, greatly improving the platform's reuse efficiency and flexibility.

[0083] 4) Expert large model evaluation

[0084] The present invention uses the F0.5 value of the character-level editing operation commonly used in the CGEC field as an evaluation indicator. This indicator calculates the F0.5 value by calculating and counting the correctness of each character editing operation, and counting the precision and recall of the editing operation. Since the CGEC field pays more attention to precision than recall, the F0.5 value is selected to reflect the performance of the model in this field. The calculation result of this indicator is directly obtained by calling the open source Cherrant tool.

[0085] See Figure 2 , the present invention uses the BART-based Alirector, the GLM-based DeCoGLM, and the SFT-based Qwen2.5-7B-Instruct as baseline models for comparative analysis. The model proposed by the present invention has a significant lead over the other three models in the final results. The two models designed for the CGEC task, the BART-based Alirector and the GLM-based DeCoGLM, performed poorly on the news norms task. Since the two models have significantly too many FP samples for input editing operations, the Precision of the two models is low, which directly leads to the lagging F0.5 value of the final result. This shows that for the input text, the two models have relatively serious misjudgments, that is, they judge and change words and sentences that originally conform to news norms. This performance is related to the characteristics of the news norms dataset itself - the basic elements of manuscripts in the news field and some words are easily confused with everyday words. By observing the outputs of the two models, it was found that the two models could not learn this characteristic of the news norms task well, and therefore produced relatively serious misjudgments.

[0086] In comparison, only SFT training of Qwen2.5-7B-Instruct can achieve a relatively good result of F0.5=0.855 on the news standardization task. This proves the powerful function of the LLM of the decoder-only architecture and the more powerful learning ability of the model with large parameters. However, there is still room for improvement in the model that simply fine-tunes SFT on Qwen2.5-7B-Instruct. The news standardization correction task is similar to the CGEC task. Compared with recall, the precision obtained by the simple SFT solution is still significantly behind recall, which proves that the precision of this solution still has a lot of room for improvement. Experiments show that the detector enhancement scheme proposed in this invention effectively solves this drawback brought by simple SFT. While maintaining relatively unchanged recall, it greatly improves the precision of model detection, thereby further improving the overall performance of the model on this task. The detector enhancement scheme further reduces the FP editing operations of the model, which shows that the detector module plays an effective guiding role in training, helping the generator to more accurately distinguish words that need to be changed and reduce misjudgments caused by oversensitivity.

[0087] See Figure 3 The test during the training phase also shows that the F1 value of the detector increases while the gen_loss of the generator decreases synchronously, which shows that the generator and the detector transmit effective information to each other during the training phase and achieve joint optimization.

[0088] The protection content of the present invention is not limited to the above embodiments. Without departing from the spirit and scope of the inventive concept, changes and advantages that can be thought of by those skilled in the art are included in the present invention and are protected by the appended claims.

Claims

1. A method for detecting and correcting standard news terms based on a large language model, characterized in that: The method specifically comprises the following steps: Step 1: Build data for detecting and generating news standard terms The task instruction plus a piece of news text extracted from a news article is input into the large language model. The output of the generated data is the modified text. The output of the test data is constructed based on the reference sequence labeling task, which is a 0 / 1 label for each token of the input text. Step 2: Build a collaborative training framework Based on the generation task, a detector module is added to build a collaborative training framework for detectors and generators. The detection and correction of news standard terms are trained in the collaborative training framework through multi-task learning, so that the trained large language model has the ability to detect and correct. Step 3: Construct initialization set, training set and validation set The training data is divided into a set to be divided and a validation set at a ratio of 4:1, and the set to be divided into an initialization set and a training set at a ratio of 4:1; Step 4: Initialization training of the detector module Initialize and train the detector module using the initialization set; Step 5: Fine-tuning of model parameters The training set was used to fine-tune the parameters of the Alibaba Cloud open-source large language model, Tongyi Qianwen 7B model Qwen-7B-Instruct, using low-rank adaptation LoRA. This resulted in an expert large model for detecting and correcting standard news terms. Step 6: Model Deployment The expert model is deployed as a service using Flask. During deployment, detection and correction can be decoupled, allowing users to choose detection services or a complete service with detection and correction.

2. The method for detecting and correcting news standard terms based on a large language model according to claim 1, characterized in that: The step 1 specifically includes: 1.1: Contextual completion For fragmented contexts in the original news text, a large language model is used to automatically complete the context with semantic meaning while preserving the original sentence. 1.2: Build and generate data For existing non-standard news texts, we replace the non-standard words with standard words based on the non-standard word library to construct an equal amount of standard text. We then splice the large language model instructions, input text, and output text using the generated template of the Qianwen 7B model to construct training data for fine-tuning the large language model. 1.3: Constructing token-level detection label data Use the word segmenter of the Tongyi Qianwen 7B model to tokenize the input text and record the offset between the token and the word. Match the non-standard words according to the non-standard vocabulary. Mark the corresponding token as 1 by querying the offset, and mark the remaining tokens as 0. Get the annotation sequence of the input text and the token-level detection label data.

3. The method for detecting and correcting news standard terms based on a large language model according to claim 1, characterized in that: The step 2 specifically includes: 2.1: Model Architecture A model architecture of generator and detector is adopted. The generator uses the generation head of the Tongyi Qianwen 7B model; the detector is a detection head composed of a bidirectional LSTM and an MLP layer. The detection head performs 0 / 1 classification on each latent vector corresponding to the input part, and obtains a 0 / 1 sequence with the same length as the input. 2.2: Training Architecture The training loss function of the large language model is reconstructed by calculating two losses, one for the generation task and the other for the detection task, and combining the two losses. The generation task loss uses a cross-entropy loss function; the detection task loss uses a weighted cross-entropy loss function; the combination of the two task losses adds a hyperparameter alpha to the detection task to narrow the data scales of the two losses and prevent the loss of one task from dominating the training.

4. The method for detecting and correcting standard news terms based on a large language model according to claim 1, wherein: The detector module initialization in step 4 specifically includes: 4.1: In the initialization stage, freeze all parameters of the Tongyi Qianwen 7B model and the generation head, use the detection head parameters for training and update, and use the initialization set to initialize the detection head at the learning rate.

5. The method for detecting and correcting news standard terms based on a large language model according to claim 1 is characterized in that: The parameter fine-tuning in step 5 specifically includes: 5.1: Write a LoRA fine-tuning script based on the open source code library peft and transformers, specifying the fine-tuning parameters of rank r, weight alpha, epoch and batch; 5.2: Load the Qwen2.5-7B model based on the transformer library; 5.3: Load the training data and Qwen2.5-7B-Instruct model into the GPU and run the fine-tuning script to fine-tune the PEFT parameters.

6. The method for detecting and correcting news standard terms based on a large language model according to claim 1, characterized in that: The step 6 specifically includes two parts: decoupling and deployment. The decoupling combines the parameters of the LoRA adapter and the detection head obtained after training with Qwen2.5-7B-Instruct to obtain an expert large model. By inputting the text into the expert large model, the correction result of the news standard terms given by the large model can be obtained; the expert large model calculates the latent vector of the input text, and inputs the obtained latent vector into the detection head to obtain the detection result. The correction and detection functions are directly decoupled and used independently of each other; the deployment uses the open source library flask to serve the expert large model, and uses the word segmenter for post-processing to mark the words detected as non-standard and the corresponding corrected words.

Citation Information

Cited By

  • RAG financial credit decision-making method based on policy mask constraint decoding

    CN121234927A