Training method of controllable and credible official document generation model

By building a document generation model of multi-source and multi-type corpus and integrating controllability gating mechanism and credibility evaluation network, the challenges of existing models in controllability, credibility and robustness are solved, high-quality, legally compliant document generation is achieved, and model performance is continuously optimized through the user feedback closed-loop mechanism.

CN119988648AActive Publication Date: 2025-05-13BEIJING INFORMATION TECH BOTE INTELLIGENT TECH CO LTD

Patent Information

Application Number
CN202510474631.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-05-13
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

The existing official document generation model has challenges in controllability, credibility and robustness, and it is difficult to control format elements and legal compliance in real time, and there is a lack of an effective closed-loop mechanism for user feedback.

Method used

By building a multi-source and multi-type corpus, a pre-trained language model based on the BART-large architecture is adopted, and a controllability gating mechanism and a trustworthiness evaluation network are integrated, and parallel training is carried out to generate a basic controllable model, trustworthy enhancement model and robust enhancement model. At the same time, a closed-loop mechanism for user feedback is established to continuously optimize model performance.

Benefits of technology

It significantly improves the quality and efficiency of official document generation, ensures the legal compliance and semantic integrity of the generated content, enhances the adaptability and stability of the model, and achieves continuous model optimization and performance improvement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988648A_ABST
    Figure CN119988648A_ABST
Patent Text Reader

Abstract

The invention discloses a training method of a controllable and credible official document generation model, which relates to the technical field of natural language processing, and comprises the following steps: S1, acquiring original official document data based on a government agency, a public database and a legal document library, establishing a multi-source and multi-type corpus, the multi-source and multi-type corpus comprises a request report, a conference summary, a notification announcement and a policy document. According to the method for training the document generation model, the natural language processing technology and document generation specifications are deeply integrated, the document generation quality and efficiency are remarkably improved, the richness and diversity of document content are ensured by constructing a multi-source and multi-type corpus, and meanwhile, the method has the advantages of being high in practicability and easy to popularize. The problems of information redundancy and different formats are effectively avoided through deduplication and standardization processing, data quality is strictly controlled through introduction of an evaluation system, reliable guarantee is provided for model training, and dynamic constraint and real-time monitoring of the official document generation process are achieved.
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 training method for a controllable and reliable official document generation model. Background Art

[0002] With the rapid development of natural language processing technology, text generation models based on deep learning have shown broad application prospects in the field of official document processing. As an important carrier for government agencies, enterprises and institutions to carry out official activities, the generation process of official documents needs to strictly follow format specifications, legal provisions and semantic logic. Traditional official document generation methods rely on template filling or rule engines. Although they can meet basic format requirements, they have obvious limitations in flexibility, semantic coherence and legal compliance. In recent years, pre-trained language models based on the Transformer architecture have significantly improved the naturalness and accuracy of text generation through large-scale corpus training, providing technical support for intelligent official document generation. Existing studies have attempted to apply these models to official document generation tasks, optimizing generation quality through domain adaptation and constraint mechanisms, but they still face multiple challenges in terms of controllability, credibility and robustness.

[0003] The current mainstream official document generation models generally have three technical bottlenecks: first, the generation process lacks a dynamic constraint mechanism, making it difficult to control format elements and legal compliance in real time, resulting in problems such as format errors or invalid policy references in the generated content; second, the model is sensitive to adversarial inputs, and is prone to logical contradictions or semantic deviations when the input contains noise or disturbances; third, the existing evaluation system focuses on language fluency, lacks quantitative evaluation of legal compliance and content consistency, and has not established an effective user feedback closed-loop mechanism, making it difficult to continuously optimize model performance. In addition, key issues such as the fusion processing of multi-source heterogeneous corpora, real-time verification of legal clauses, and credibility tracing of generated results have not yet been effectively resolved. In this regard, we propose a training method for a controllable and credible official document generation model. Summary of the invention

[0004] In order to solve the above technical problems, a method for training a controllable and reliable official document generation model is provided. This technical solution solves the above problems.

[0005] In order to achieve the above purpose, the technical solution adopted by the present invention is: A training method for a controllable and reliable official document generation model comprises the following steps: S1. Collect original official document data from government agencies, public databases and legal document libraries to establish a multi-source and multi-type corpus, which includes: request reports, meeting minutes, notices and policy documents; S2, de-duplication and standardization of the collected corpus raw data; S3. Establish an evaluation system consisting of a format checker, a legal compliance detection module, and a semantic integrity analyzer to evaluate data quality, and divide the data into a training set and a test set based on the evaluated data; S4. Build a pre-trained language model based on the BART-large architecture, integrating the controllability gating mechanism and the credibility evaluation network; S5. Parallel training of the basic controllable model, the trustworthy enhancement model and the robustness enhancement model. The trustworthy enhancement model is connected to the legal and regulatory database in real time for verification. The robustness enhancement model injects adversarial noise and dynamically monitors the controllable deviation and legal compliance of the generated content through the test set, triggering the early stopping mechanism to prevent overfitting. S6. Perform validation set performance weighted parameter fusion on the three types of models that have been trained to generate the final deployment model, and automatically trigger iterative optimization through a user feedback closed-loop mechanism.

[0006] Preferably, the deduplication and standardization processing in step S2 specifically includes: The deduplication process specifically includes: The improved SimHash algorithm is used to generate 64-bit document fingerprints, and the document similarity calculation is defined as: ; In the formula, For Documentation With Documentation The similarity of Document fingerprint and The Hamming distance of When the similarity is greater than a preset threshold, it is determined to be a nearly duplicate document and the duplicate document is removed; Among them, the standardized processing includes mandatory conversion of date format, conversion of amount numbers into uppercase Chinese characters, and mapping of full name of institution.

[0007] Preferably, the workflow of the evaluation system is: The format checker uses regular expressions to match the structural elements of official documents, including the combination rules of the agency code, year and sequence number of the document number; The legal compliance detection module matches policy terms based on the knowledge graph and outputs a compliance score. The calculation formula is: ; In the formula, Score compliance with laws, To generate the total number of terms, For the Generate clauses, A collection of legal knowledge bases. is the indicator function; The semantic completeness analyzer uses the RoBERTa model to calculate the contextual coherence score.

[0008] Preferably, the controllability gating mechanism comprises: The rule constraint layer deploys the Drools rule engine that includes official document writing specifications, which can intercept missing document number agency codes and document type usage errors in real time; The dynamic gating unit calculates the gating weights in the decoder: ; In the formula, For the The gating weight of the step, is the Sigmoid activation function, is the weight matrix of the gating mechanism, is the current hidden state of the decoder, The matching degree between the currently generated content and the preset template; The backtracking correction mechanism performs local regeneration on the illegal paragraphs and retains the Top-3 compliant candidate sequences.

[0009] Preferably, the credibility evaluation network comprises: The legal clause checker verifies the timeliness of referenced clauses through the national laws and regulations database API, and automatically replaces expired clauses with the latest version; The logical contradiction detector constructs a time-event relationship graph to identify timing conflicts in generated content; Source credibility score module calculation: ; In the formula, For the overall credibility score, Score for legal compliance, Score for content consistency, is the weighting coefficient.

[0010] Preferably, the training of the robustness enhancement model includes: injecting Gaussian noise into the input layer, and the noise intensity obeys ; Adopt FGM adversarial training strategy and add disturbance terms: ; In the formula, To train the perturbed parameters against each other, are the original model parameters, is the disturbance intensity, is the gradient vector, is the L2 norm of the gradient; Add robustness loss term: ; In the formula, is the robustness loss, For the expected operation, For data distribution The input sampled in is the input noise, is the model function.

[0011] Preferably, the validation set performance weighted parameter fusion is specifically: exponential smoothing weighting is performed on the validation set losses of the three types of models, and the weight formula is: ; In the formula, For the The weight of the model, Corresponding to three types of models, For the The validation set loss of the model, is the exponential smoothing term; The encoder layer parameters are weighted fused using cosine similarity, and the decoder layer implements the Top-k credibility voting mechanism to retain the generation head parameters of the highest weight model.

[0012] Preferably, the user feedback closed-loop mechanism includes: parsing feedback features into triples, wherein the triples include: error type, original content and correction result, and establishing a feedback database; starting online incremental learning for high-frequency error types, and updating the formula as follows: ; In the formula, are the updated model parameters, are the original model parameters, is the learning rate, For the parameters The gradient of To generate the loss, is the feedback loss, is the weighting coefficient of feedback loss.

[0013] Preferably, the model deployment includes: encapsulating the final model as a RESTful API service that supports template input, allowing users to configure the credibility threshold; implementing real-time credibility monitoring, and calculating the risk index for the generated paragraphs: ; In the formula, To generate a risk index for a paragraph, is the risk item weighting coefficient, is the single paragraph risk score, is the weighted coefficient of the credibility item, Scoring the credibility of generated content; Each generated result comes with a model version number, training data snapshot ID, and a credibility assessment report.

[0014] Preferably, the workflow of the legal compliance detection module is: construct a legal text knowledge graph and decompose the clauses into Four-tuple; use BiDAF model to match terms and calculate the maximum slice similarity between query statements and knowledge base entries; for detected expired terms, recommend alternatives based on comprehensive ranking of edit distance and semantic similarity. The recommendation formula is: ; In the formula, For alternative terms The ranking score of For the original terms With alternative clauses The semantic similarity of is the edit distance, is the weighted coefficient of semantic similarity and edit distance.

[0015] Compared with the prior art, the present invention has the following beneficial effects: The training method of the official document generation model proposed in the present invention significantly improves the quality and efficiency of official document generation by deeply integrating natural language processing technology with official document generation specifications. The method ensures the richness and diversity of official document content by constructing a multi-source and multi-type corpus. At the same time, deduplication and standardization processing effectively avoid the problems of information redundancy and different formats. The introduction of the evaluation system strictly controls the data quality, provides reliable guarantees for model training, realizes dynamic constraints and real-time monitoring of the official document generation process, and significantly improves the legal compliance and semantic integrity of the generated content. In addition, by training the basic controllable model, the trusted enhancement model and the robustness enhancement model in parallel, the adaptability and stability of the model are further enhanced, effectively resisting the influence of adversarial input, and establishing a user feedback closed-loop mechanism, which can continuously collect and analyze user feedback, continuously optimize model performance, and ensure the continuous improvement of official document generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a step diagram of the training method of the present invention; Figure 2 The present invention is a mind map of the training method. DETAILED DESCRIPTION

[0017] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art may think of other obvious variations.

[0018] Reference Figure 1 As shown, a training method for a controllable and reliable official document generation model includes the following steps: S1. Collect original official document data from government agencies, public databases and legal document libraries to establish a multi-source and multi-type corpus, which includes: request reports, meeting minutes, notices and policy documents; S2, de-duplication and standardization of the collected corpus raw data; S3. Establish an evaluation system consisting of a format checker, a legal compliance detection module, and a semantic integrity analyzer to evaluate data quality, and divide the data into a training set and a test set based on the evaluated data; S4. Build a pre-trained language model based on the BART-large architecture, integrating the controllability gating mechanism and the credibility evaluation network; S5. Parallel training of the basic controllable model, the trustworthy enhancement model and the robustness enhancement model. The trustworthy enhancement model is connected to the legal and regulatory database in real time for verification. The robustness enhancement model injects adversarial noise and dynamically monitors the controllable deviation and legal compliance of the generated content through the test set, triggering the early stopping mechanism to prevent overfitting. S6. Perform validation set performance weighted parameter fusion on the three types of models that have been trained to generate the final deployment model, and automatically trigger iterative optimization through a user feedback closed-loop mechanism.

[0019] In the actual implementation process of the training method of the controllable and reliable official document generation model described in the present invention, it is first necessary to build a document corpus covering multiple sources and types. Obtain normative documents through the government information disclosure platform, extract meeting minutes templates from the public database, integrate the standard clauses in the legal document library, and form an initial data set containing categories such as request reports, notices and announcements. In the data preprocessing stage, the improved SimHash algorithm is used to perform fingerprint comparison on the documents, and the similarity threshold is set to automatically filter and eliminate duplicate documents to ensure the uniqueness of the corpus content. The standardization processing link uses a preset rule engine to uniformly convert the date format. For example, "2023.12.31" is standardized as "December 31, 2023", and the numbers involving the amount are converted to Chinese capital letters. A mapping table between the full name of the institution and the standardized abbreviation is established to ensure the consistency of the data format.

[0020] In terms of model architecture design, BART-large is selected as the basic pre-training model, and the dynamic constraints of the generation process are realized by introducing a controllable gating mechanism. In specific implementation, a rule constraint module is embedded in the decoder layer to monitor in real time whether the generated content complies with the official document writing specifications, such as detecting the correctness of the agency code in the document number and the accuracy of the use of the document type. When a format error is found or the reference to a legal clause is out of date, the system immediately triggers the backtracking correction mechanism and retains multiple compliant candidate sequences for local regeneration. At the same time, a credibility assessment network is constructed to connect to the API interface of the national laws and regulations database to verify the timeliness of the policy clauses cited in the generated content and automatically replace the abolished versions of the clauses. The logical contradiction detection module analyzes the temporal logic conflicts in the generated content by constructing a time-event relationship graph, such as the contradiction that the meeting resolution time is earlier than the meeting time.

[0021] A three-way parallel training strategy is adopted in the model training phase. The basic controllable model focuses on learning the format specifications of official documents. The trust enhancement model strengthens the accuracy of clause references through a real-time legal verification mechanism. The robustness enhancement model injects Gaussian noise into the input layer and adopts an adversarial training strategy to improve anti-interference capabilities. During the training process, the legal compliance deviation on the test set is dynamically monitored. When it is detected that the generated content has format errors for multiple consecutive rounds or the clause references are invalid, the early stopping mechanism is immediately triggered to prevent the model from overfitting. During the adversarial training process, a disturbance term is added during the gradient update to force the model to maintain a stable generation quality under noise interference, while increasing the robustness loss function to constrain the consistency of the generated results.

[0022] In the model fusion stage, differentiated parameter fusion is implemented according to the performance of the validation set. The validation set losses of the basic controllable model, the trustworthy enhanced model, and the robustness enhanced model are weighted by exponential smoothing. The encoder layer adopts a cosine similarity weighted parameter fusion strategy, and the decoder layer implements a voting mechanism based on credibility score to retain the optimal generation header parameters. The final deployment model is encapsulated as a configurable API service, which supports user-defined credibility thresholds and generates paragraph risk index assessment reports in real time. The system has built-in version management functions, and each generation result is accompanied by a training data snapshot identifier and a legal compliance detection log to ensure that the generation process is traceable.

[0023] The user feedback mechanism builds a closed-loop optimization system, which parses the error types annotated by users into structured triples and stores them in the feedback database. For high-frequency format errors or legal clause citation problems, the system automatically starts online incremental learning, and performs targeted optimization on specific error types while maintaining the performance of the original model. Feedback data is integrated into the model parameter update process through a weighted loss function to form a continuous iterative self-improvement mechanism. At the same time, a dynamic update interface for the legal knowledge graph is established. When a new version of the legal and regulatory database is detected, the model retraining process is automatically triggered to ensure that the generated content always meets the latest policy requirements. After the entire system is deployed, the generated quality indicators are displayed in real time through a visual monitoring panel, including format compliance rate, legal clause update timeliness and user satisfaction score, providing data support for model optimization.

[0024] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. The present invention may be subject to various changes and improvements without departing from the spirit and scope of the present invention. These changes and improvements fall within the scope of the present invention. The scope of protection claimed by the present invention is defined by the attached claims and their equivalents.

Claims

1. A training method for a controllable and reliable official document generation model, characterized in that: The following steps are involved: S1. Collect original official document data from government agencies, public databases and legal document libraries to establish a multi-source and multi-type corpus, which includes: request reports, meeting minutes, notices and policy documents; S2, de-duplication and standardization of the collected corpus raw data; S3. Establish an evaluation system consisting of a format checker, a legal compliance detection module, and a semantic integrity analyzer to evaluate data quality, and divide the data into a training set and a test set based on the evaluated data; S4. Build a pre-trained language model based on the BART-large architecture, integrating the controllability gating mechanism and the credibility evaluation network; S5. Parallel training of the basic controllable model, the trustworthy enhancement model and the robustness enhancement model. The trustworthy enhancement model is connected to the legal and regulatory database in real time for verification. The robustness enhancement model injects adversarial noise and dynamically monitors the controllable deviation and legal compliance of the generated content through the test set, triggering the early stopping mechanism to prevent overfitting. S6. Perform validation set performance weighted parameter fusion on the three types of models that have been trained to generate the final deployment model, and automatically trigger iterative optimization through a user feedback closed-loop mechanism.

2. The training method of a controllable and reliable official document generation model according to claim 1 is characterized in that: The deduplication and standardization process described in step S2 is as follows: include: The deduplication process specifically includes: The improved SimHash algorithm is used to generate 64-bit document fingerprints, and the document similarity calculation is defined as: ; In the formula, For Documentation With Documentation The similarity of Document fingerprint and The Hamming distance of When the similarity is greater than a preset threshold, it is determined to be a nearly duplicate document and the duplicate document is removed; Among them, the standardized processing includes mandatory conversion of date format, conversion of amount numbers into uppercase Chinese characters, and mapping of full name of institution.

3. The training method of a controllable and reliable official document generation model according to claim 1 is characterized in that: The workflow of the evaluation system is as follows: The format checker uses regular expressions to match the structural elements of official documents, including the combination rules of the agency code, year and sequence number of the document number; The legal compliance detection module matches policy terms based on the knowledge graph and outputs a compliance score. The calculation formula is: ; In the formula, Score compliance with laws, To generate the total number of terms, For the Generate clauses, A collection of legal knowledge bases. is the indicator function; The semantic completeness analyzer uses the RoBERTa model to calculate the contextual coherence score.

4. The training method of a controllable and reliable official document generation model according to claim 1 is characterized in that: The controllability gating mechanism comprises: The rule constraint layer deploys the Drools rule engine that includes official document writing specifications, which can intercept missing document number agency codes and document type usage errors in real time; The dynamic gating unit calculates the gating weights in the decoder: ; In the formula, For the The gating weight of the step, is the Sigmoid activation function, is the weight matrix of the gating mechanism, is the current hidden state of the decoder, The matching degree between the currently generated content and the preset template; The backtracking correction mechanism performs local regeneration on the illegal paragraphs and retains the Top-3 compliant candidate sequences.

5. The training method of a controllable and reliable official document generation model according to claim 1 is characterized in that: The credibility evaluation network comprises: The legal clause checker verifies the timeliness of referenced clauses through the national laws and regulations database API, and automatically replaces expired clauses with the latest version; The logical contradiction detector constructs a time-event relationship graph to identify timing conflicts in generated content; Source credibility score module calculation: ; In the formula, For the overall credibility score, Score for legal compliance, Score for content consistency, is the weighting coefficient.

6. The training method of a controllable and reliable official document generation model according to claim 1, characterized in that: The training of the robustness enhancement model includes: injecting Gaussian noise into the input layer, and the noise intensity obeys ; Adopt FGM adversarial training strategy and add disturbance terms: ; In the formula, To train the perturbed parameters against each other, are the original model parameters, is the disturbance intensity, is the gradient vector, is the L2 norm of the gradient; Add robustness loss term: ; In the formula, is the robustness loss, For the expected operation, For data distribution The input sampled in is the input noise, is the model function.

7. The training method of a controllable and reliable official document generation model according to claim 1 is characterized in that: The validation set performance weighted parameter fusion is specifically: exponential smoothing weighting is performed on the validation set losses of the three types of models, and the weight formula is: ; In the formula, For the The weight of the model, Corresponding to three types of models, For the The validation set loss of the model, is the exponential smoothing term; The encoder layer parameters are weighted fused using cosine similarity, and the decoder layer implements a Top-k credibility voting mechanism to retain the generation head parameters of the highest weight model.

8. The training method of a controllable and reliable official document generation model according to claim 1 is characterized in that: The user feedback closed-loop mechanism includes: parsing feedback features into triplets, wherein the triplets include: error type, original content, and correction result, and establishing a feedback database; starting online incremental learning for high-frequency error types, and updating the formula as follows: ; In the formula, are the updated model parameters, are the original model parameters, is the learning rate, For the parameters The gradient of To generate the loss, is the feedback loss, is the weighting coefficient of feedback loss.

9. The method for training a controllable and reliable official document generation model according to claim 1, characterized in that: The model deployment includes: encapsulating the final model as a RESTful API service that supports template input, allowing users to configure the credibility threshold; implementing real-time credibility monitoring, and calculating the risk index for the generated paragraphs: ; In the formula, To generate a risk index for a paragraph, is the risk item weighting coefficient, is the single paragraph risk score, is the weighted coefficient of the credibility item, Scoring the credibility of generated content; Each generated result comes with a model version number, training data snapshot ID, and a credibility assessment report.

10. The method for training a controllable and reliable official document generation model according to claim 1, characterized in that: The workflow of the legal compliance detection module is as follows: construct a knowledge graph of legal provisions and decompose the clauses into Four-tuple; use BiDAF model to match terms and calculate the maximum slice similarity between query statements and knowledge base entries; for detected expired terms, recommend alternatives based on comprehensive ranking of edit distance and semantic similarity. The recommendation formula is: ; In the formula, For alternative terms The ranking score of For the original terms With alternative clauses The semantic similarity of is the edit distance, is the weighted coefficient of semantic similarity and edit distance.

Citation Information

Patent Citations

  • Document data processing method under large model scene

    CN119088933A

  • Large model corpus processing method and system

    CN119539074A

  • Intelligent legal document generation method and system based on large model

    CN119669485A

  • Document generation method based on large model and knowledge graph fusion

    CN119719386A

  • Intelligent official document generation method based on large model and knowledge base

    CN119783638A

Cited By

  • Large model-based standard document automatic generation and multi-dimensional auditing method and system

    CN120597846A

  • Method and system for automatic generation and multi-dimensional review of standard documents based on large models

    CN120597846B

  • Evaluation model optimization and dynamic calibration method based on meta-evaluation feedback

    CN120806034A

  • Service quality evaluation system

    CN120996641A

  • Quality of service assessment system

    CN120996641B