A method and system for automatic document generation based on multi-stage fact extraction and verification
By using a multi-stage generation pipeline and deterministic verification mechanism, enterprise project materials are categorized by business type. Customized slot extraction and procedural quality checks are employed to solve the problem of generating documents with uniform structure, accurate facts, and traceable sources, thus achieving automated generation and auditability of high-quality documents.
Patent Information
- Application Number
- CN202611346022.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-01
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies struggle to generate project documents from enterprise projects that are structurally consistent, factually accurate, and traceable in origin. They lack the ability to categorize and guide materials by business type and to extract them in a targeted manner. The verification process relies on subjective judgment from a large language model, and the traceability of origin depends on annotations during model generation. They lack deterministic and precise mapping and detection of untraceable content, and they lack structured quality verification and automatic correction triggering mechanisms.
Through a multi-stage generation pipeline and deterministic verification mechanism, input materials are categorized by business type, and specially customized slot extraction prompts are used to merge them into a unified fact list. Each item is verified and revised, and procedural quality checks are conducted to ensure that source markers are deterministically mapped back to the original documents.
It enables the generation of high-quality documents with accurate structure, credible facts, and traceable sources without human intervention, reducing the burden of manual review and improving the auditability and stability of the generated quality.
Smart Images

Figure CN123180106A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of document automation processing technology, specifically to a method and system for automated document generation based on multi-stage fact extraction and verification. It is particularly suitable for automatically generating project documents with unified structure, accurate facts, and traceable sources from multi-source unstructured materials in enterprise project knowledge accumulation scenarios. Background Technology
[0002] As enterprises continue to advance their digital operations, project-driven organizations accumulate a large amount of unstructured materials such as Word and PowerPoint presentations during the processes of requirements analysis, solution design, implementation and delivery, and project debriefing. These materials are scattered in origin, inconsistent in structure, and the same facts may appear repeatedly in different documents, be incompletely described, or contain discrepancies in terminology. Transforming these materials into a standardized, factually accurate, and traceable project knowledge document requires manual work involving material selection, factual organization, chapter planning, text writing, content verification, and formatting delivery. This process is lengthy, and the quality of the final draft is easily affected by the writer's business understanding and writing skills.
[0003] In recent years, large-scale language models have demonstrated strong capabilities in document understanding, information extraction, and long text generation. Related technologies have evolved from single-prompt generation to multi-stage pipelines encompassing document processing, information retrieval, structure planning, segmented writing, and factual revision. However, enterprise project documents also require the simultaneous handling of facts from multiple sources, conflicting statements, sensitive fields, fixed chapter structures, and precise source location. Existing solutions typically only cover some of these aspects, making it difficult to directly establish a complete, auditable, and automated process from raw materials to a credible final draft.
[0004] One known solution in the existing technology is DoCETL: Agentic Query Rewriting and Evaluation for Complex Document Processing. This solution allows users to declaratively define complex document processing pipelines consisting of multiple language model operations, and uses agents to rewrite the pipeline logic and optimize the solution. When a single model call is insufficient to fully extract information from a long document, the system can split tasks or data, and complete block processing, aggregation, and result normalization through operations such as map, reduce, and semantic duplicate item merging; at the same time, it automatically generates task-related verification prompts, evaluates candidate solutions, and iteratively improves based on feedback. This solution can alleviate the problems of information omission and aggregation inconsistency in long document processing, but it mainly focuses on optimizing document analysis and data processing pipelines. It does not disclose a complete outline planning, chapter-by-chapter writing, and draft export mechanism for fixed enterprise knowledge documents, nor does it form a unified fact list, text item-by-item verification, programmatic source indexing, and pre-delivery quality verification for use by multiple generation stages.
[0005] Another existing technical solution is STORM: Assisting in Writing Wikipedia-like Articles From Scratch with Large Language Models. This solution divides the generation of long articles into two stages: pre-writing and main text writing. First, the topic is studied from multiple perspectives, simulating the writer asking multiple rounds of questions to experts based on credible online sources. Then, the obtained information is organized to generate a multi-level outline and a collection of references. Subsequently, materials are retrieved section by section according to the outline to generate a complete article with citations. This solution reflects a phased approach of "data collection - outline planning - section writing," which can improve the structure and coverage of long articles. However, its input mainly consists of the research topic and online search results, and it does not have mechanisms for business category guidance, slotted fact extraction, cross-source deduplication, and conflict labeling for multiple documents within an enterprise. The paper also reports problems such as missing citations, inappropriate inferences, incorrect rewriting, or citations of irrelevant sources, indicating that adding citations during generation is still insufficient to form a definitive guarantee of factual quality and source mapping.
[0006] Another existing technical solution is RARR: Researching and Revising What Language Models Say, Using Language Models. This solution first generates factual questions based on the text to be verified, and then retrieves and filters external evidence. Subsequently, a consistency judgment model checks for discrepancies between the text and the evidence. If inconsistencies are found, an editing model is invoked to make local modifications, and finally, revised text and an evidence report are output. This solution connects evidence retrieval, fact judgment, and text revision into a feedback process, but it still relies on generative models to complete question generation, judgment, and editing. It does not explicitly handle conflicting evidence from different sources, nor does it establish a pre-summarized, deduplicated, and conflict-marked authoritative factual draft. Its evidence report does not disclose the programmatic mapping of text markers back to the local original file, paragraph, or slide location, nor does it cover delivery rule checks such as chapter integrity, sensitive information anonymization, and prohibited expressions.
[0007] In summary, the existing technical solutions have the following four shortcomings: First, they lack the ability to guide and extract materials by business type; second, the verification process relies on the subjective judgment of the large language model and lacks a deterministic auditable mechanism; third, source tracing relies on annotation during model generation and cannot achieve deterministic and accurate mapping and detection of untraceable content; and fourth, they lack a structured quality verification and automatic correction triggering mechanism. Summary of the Invention
[0008] The purpose of this invention is to propose a document automatic generation method and system based on multi-stage fact extraction and verification. It aims to systematically solve the core technical problems faced in the process of automatically generating high-quality and reliable documents from unstructured project materials through a multi-stage generation pipeline and deterministic verification mechanism.
[0009] Specifically, the technical problems to be solved by the present invention include:
[0010] First, how to accurately extract information of different natures from diverse and unstructured project materials according to business type, and integrate it into a credible factual document after deduplication and conflict annotation. Addressing the problem of information confusion and factual omissions caused by the uniform mixed processing of input materials in existing technologies, this invention needs to overcome the limitations of indiscriminate material input in existing technologies. It needs to establish a mechanism that pre-classifies and guides input materials according to business categories (such as basic information / background requirements, solutions / delivery processes, results evaluation / pain points and highlights), and customizes corresponding slot extraction strategies for each category. Furthermore, it needs to merge extraction results from multiple sources, which may have different interpretations, into a unified fact list, automatically identifying and annotating conflicting information and missing fields, providing unique and credible factual evidence for subsequent writing.
[0011] Secondly, how can a deterministic and auditable fact-checking mechanism be established during the document generation process of a large language model to control model illusions and ensure the factual accuracy of the final draft? Addressing the problem that existing verification processes rely on the subjective judgment of the large language model and lack verifiable benchmarks, thus failing to achieve auditability, this invention proposes a verification process based on a structured fact draft. This process compares the generated content against a pre-set fact list item by item, outputting a clear list of issues and conclusions for approval / revision / rewriting. Simultaneously, a deterministic feedback loop of "writing-verification-revision" is established, enabling factual errors, unfounded inferences, and exaggerated expressions in chapter drafts to be corrected at the editing stage, rather than relying on the model's unreliable self-judgment.
[0012] Third, how can we achieve accurate source tracing through non-model-based procedural means after document generation, and automatically identify and report citations that cannot be uniquely mapped? Addressing the problems of existing source tracing technologies relying on large language models to annotate citation sources during generation, failing to achieve deterministic mapping decoupled from model behavior, and lacking the ability to detect untraceable content, this invention provides a post-processing source tracing method. This method does not require calling a large language model; instead, it uses procedural string matching and position inference to deterministically map source markers in the text back to the original file, paragraph number, and original text excerpt. Simultaneously, it needs to automatically identify fuzzy citations that cannot be uniquely mapped, generating a list to be confirmed to ensure the integrity of the source tracing results and controllable uncertainty.
[0013] Fourth, how to automatically perform structured quality checks before the final draft is output, and trigger limited model revisions or output suspension based on the check results, to replace the reliance on manual item-by-item review. Addressing the problem that existing technologies lack structured, configurable quality checks, and that final draft quality assurance still relies on comprehensive manual review, this invention needs to establish a rule-based and keyword-based procedural quality detection mechanism. This mechanism automatically scans for check items that can be judged one by one, such as chapter structure integrity, manually confirmed boundary coverage, and prohibited sentiments or inferential expressions, before the final draft is submitted. When a check fails, the specific issue is fed back to the editor-in-chief model to trigger a one-time revision retry. If the revision still fails, output is suspended and a detailed audit record is generated, thus completing structured closed-loop control of the final draft quality without human intervention.
[0014] In summary, the core technical problem to be solved by this invention can be summarized as follows: in the process of automatically generating documents for enterprise project knowledge accumulation, how to organically integrate the four links of business classification guidance of input materials, deterministic verification based on fact lists, programmatic source index generation, and structured quality verification and control, and build a full-process, auditable generation pipeline from unstructured materials to high-quality and reliable documents.
[0015] To achieve this objective, the present invention adopts the following technical solution:
[0016] A method and system for automated document generation based on multi-stage fact extraction and verification is presented. The core of this method is as follows: First, input materials are placed into predefined business blocks according to business categories. Each block uses specially customized prompts for slot extraction. Then, the extraction results are merged into a unified fact list that has been deduplicated and conflict-marked. Based on this fact list, outline planning, chapter writing, fact verification, and editor-in-chief revision are executed sequentially, forming a multi-stage generation pipeline. During the verification stage, chapter drafts are compared item by item with the fact list, outputting a clear list of issues and conclusions of approval / revision / rewriting. Before the final draft is submitted, a procedural quality check is performed, triggering automatic retries for unqualified items; if still unqualified, the output is stopped. After document generation, through matching and position inference, source markers in the text are definitively mapped back to the original file, paragraph number, and original text excerpt, and items that cannot be uniquely mapped are automatically listed for confirmation.
[0017] Through the above-mentioned technical means, the present invention can generate high-quality documents from unstructured project materials that are structurally accurate, factually reliable, and traceable in origin without human intervention.
[0018] The technical solution provided by this invention may include the following beneficial effects:
[0019] (1) This invention categorizes and organizes input materials by predefining multiple business blocks and configures specially customized slot extraction prompts for each block. It can extract information of different natures according to business type. Then, through the merging stage, it automatically performs deduplication, conflict labeling, and information gap identification to form a unified fact list. Compared with DoCETL, which is mainly for splitting, aggregating, and optimizing declarative document processing pipelines, and STORM, which is mainly for topic research, data organization, and section writing, this invention further establishes a business category guidance, block-specific slots, and cross-source fact merging mechanism for multiple documents within an enterprise. This reduces mutual interference between information of different natures, fact omissions, and content attribution errors, providing a clear, reliable, and verifiable fact draft for subsequent generation.
[0020] (2) This invention breaks down the document generation process into multiple independent stages. During the verification stage, the chapter drafts are compared item by item with the unified fact list, outputting clear pass / revision / rewrite conclusions and a specific issue list. Then, the chief editor stage performs revisions based on the verification feedback, forming a closed loop of fact list → writing → verification → revision. Compared to DoCETL, which mainly uses verification prompts to evaluate candidate document processing pipelines and RARR dependency model to generate fact issues, judge evidence disagreements, and perform local editing, this invention sets up a unified fact list and structured issue report for use by multiple generation stages. This allows the verification basis, issue location, and revision process to be recorded and tracked, improving the auditability of fact review.
[0021] (3) After document generation, this invention does not invoke a large language model. Instead, it uses purely procedural string matching and position inference to definitively map source markers in the text back to the original file, paragraph, or slide number and original text excerpt, and automatically lists items that cannot be uniquely mapped and require confirmation. Compared to STORM, which adds references during the generation stage but may still result in missing or improper references, and RARR's evidence report, which does not disclose the procedural mapping of the specific location of local enterprise documents, this invention decouples source tracing from model behavior and explicitly reports items that cannot be uniquely mapped, thereby improving the stability of source location and audit efficiency.
[0022] 4. This invention implements a procedural quality gate check before the final draft is submitted to disk. It performs rule-based and keyword-based checks on key constraints such as chapter structure integrity, manually confirmed boundary coverage, and prohibited expressions. If any fail to meet the requirements, it triggers a one-time automatic revision retry; if the retry still fails, the output is aborted. Doctl, STORM, and RARR focus on document processing pipeline optimization, long document generation, and factual revision, respectively, but none of them disclose the aforementioned structured quality gate and failure abort mechanism for the final deliverable. Therefore, this invention can automatically intercept structural errors and stylistic violations before delivery, reducing the burden of manual item-by-item review and achieving closed-loop quality assurance. Attached Figure Description
[0023] Figure 1 This is a schematic diagram of the overall pipeline execution process of the present invention.
[0024] Figure 2 This is a schematic diagram of the slot extraction and unified fact list construction process guided by the business block of this invention.
[0025] Figure 3 This is a schematic diagram of the closed-loop process of writing, verifying, and revising by the editor-in-chief based on a unified fact list, as described in this invention.
[0026] Figure 4 This is a schematic diagram illustrating the final draft quality gate, source index, and audit delivery mechanism of this invention. Detailed Implementation
[0027] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that the specific embodiments described herein are for illustrative and explanatory purposes only and are not intended to limit the present invention.
[0028] like Figure 1 As shown, this invention constructs a fully auditable generation pipeline from unstructured input materials to formatted documents. This pipeline consists of multiple independent stages arranged serially, each with a clearly defined technical responsibility and a defined input / output data format. Data exchange between stages is achieved through a file system, and each stage can be independently debugged, replaced, or optimized in parallel.
[0029] The document parsing and evidence slicing stages are completed by program rules and do not call the large language model. The slot extraction, merging, outlining, writing, verification and editing stages call the large language model. Each stage is equipped with independent Chinese prompt words. The prompt words are snapshotted to the output directory every time the program runs to ensure reproducibility. The quality gate, Word export and source indexing stages return to programmatic processing and do not rely on the large language model to ensure the determinism and reproducibility of the results.
[0030] This invention provides a method and system for automated document generation based on multi-stage fact extraction and verification, specifically including:
[0031] Step S1: Classify and organize input materials based on business blocks;
[0032] like Figure 2 As shown, the system predefines three business block directories, corresponding to the three business categories of "Basic Information / Background Requirements," "Solution / Delivery Process," and "Results Evaluation / Pain Points and Highlights." Business blocks refer to the preset category directories provided by the system, used to guide users to categorize and store uploaded project materials according to their business nature, providing a clear business context for subsequent slot extraction.
[0033] When submitting materials, users place each file into one or more business block directories that they deem most relevant. The system traverses each block directory to find the input files, recording the filename, the block list to which it belongs, and the source description for each file, generating an input materials list. Simultaneously, the system checks whether the user has provided a custom writing requirements file in a specified path. These requirements will serve as input parameters for subsequent writing stages but will not be involved in fact extraction or list merging.
[0034] This step overcomes the problems of information confusion and fact omission caused by the uniform and mixed input of materials without differentiation in the existing technology by predefining business blocks and guiding users to actively classify and store them. It provides a clear business context for the targeted slot extraction of each block in the future.
[0035] Step S2: Document parsing and evidence segmentation;
[0036] The system selects the appropriate parser based on the file extension: for docx files, the python-docx library is used to extract paragraph text, while recording paragraph numbers; for pptx files, the python-pptx library is used to extract text from shapes one by one for each slide, recording slide numbers. The parser preserves the original facts without rewriting, does not add content for missing text fields, and does not perform any summarization or inference.
[0037] The slicer then reads the full text of each parsed document and slices it using a sliding window according to a preset segment length (e.g., 1800 characters) and overlap (e.g., 160 characters). Each slice is encapsulated as an evidence fragment object, which is required to retain its source file path, fragment number, start and end character offsets in the original text, and the slice text content.
[0038] This step generates traceable text units with precise paragraph or slide numbers through programmatic document parsing and sliding window slicing, effectively avoiding the context loss or source confusion that may occur when large language models directly process long documents later.
[0039] Step S3: Extract slots customized according to business blocks;
[0040] The system pre-writes independent slot extraction prompts for each of the three business blocks. Taking the "Basic Information / Background Requirements" block as an example, its slots include: customer name, project name, project type, project cycle, contract amount, project background, project objectives, and business requirements. Taking the "Solution / Delivery Process" block as an example, its slots include: overall solution, solution module list, delivery stages and milestones, and key deliverables. Taking the "Results Evaluation / Pain Points and Highlights" block as an example, its slots include: project results, customer evaluation, candidate project pain points, and candidate project highlights.
[0041] The system invokes the large language model to perform a slot extraction task for each block. The model extracts facts from the given evidence fragments according to the specific prompts for that block and populates them into a pre-defined structured table. Each row of the table corresponds to a slot, containing fields such as "slot name," "fact content," "evidence source (filename / location / evidence ID)," "confidence level," and "remarks."
[0042] The prompts clearly state that only information explicitly stated in the evidence can be used, and fabricated customer reviews, revenue figures, amounts, or periods are prohibited; the source of evidence must be written in a locatable format (e.g., "Project Completion Report pptx / Slide20 / E-047"); if the same fact is described inconsistently in different sources, it must be written that "manual confirmation is required".
[0043] This step uses specially customized prompts for each block to ensure that the extraction results focus on the information needs of that business category. In conjunction with the material partitioning blocks in step S1, it effectively solves the technical problem of accurately extracting information of different natures from diverse unstructured materials according to business type.
[0044] Step S4: Merge the fact lists;
[0045] The system calls the large language model to merge the extraction results of the three blocks into a single fact list. The merging logic is executed sequentially according to the preset slot groups, and includes four fixed parts: the first part is the basic project information (merging customer name, project name, project type, project cycle, contract amount, etc.); the second part is the project background, objectives, and business requirements; the third part is the solution and delivery process; and the fourth part is the project deliverables, evaluation, pain points, and candidate highlights.
[0046] Key processing steps during the merging process include: (1) Deduplication – When the same fact appears in multiple blocks, it is merged into one record and all sources of evidence are retained; (2) Conflict labeling – When there are differences in the description of the same fact in different blocks, a separate “Conflict Labeling” section is created in the list; (3) Gap identification – For each preset slot, if the corresponding fact is not found in all blocks, it is recorded in the “Information Gap and Manual Confirmation Items” section.
[0047] This step integrates the extraction results scattered across multiple blocks into a single source of fact, which serves as the sole basis for all subsequent writing, verification, and revision stages. Through automated deduplication, conflict annotation, and gap identification, a complete closed loop is formed: "Classification Guidance → Targeted Extraction → Conflict Identification → Unified List".
[0048] Step S5: Outline Planning;
[0049] like Figure 3 As shown, the system invokes a large language model to plan the outline of the final document based on a fact list, but it must strictly adhere to the preset fixed chapter structure, and chapter titles cannot be added, deleted, or modified. The fixed chapter structure must include at least a project introduction chapter, a project content chapter, a project results chapter, a project summary chapter, a solution chapter, and a manually confirmed boundary chapter.
[0050] The fixed chapter structure is as follows: "0 Project Introduction" chapter; "1 Project Content" chapter (including sub-chapters "1.1 Cooperation Background", "1.2 Project Objectives", "1.3 Business Requirements", and "1.4 Solutions", with "1.4 Solutions" being the solution chapter); "2 Project Results" chapter (including sub-chapters "2.1 Results and Benefits" and "2.2 Customer Evaluation"); "3 Project Summary" chapter (including sub-chapters "3.1 Project Pain Points", "3.2 Project Highlights", and "3.3 Other Supplements", with "3.1 Project Pain Points" and "3.2 Project Highlights" being manually confirmed boundary chapters).
[0051] The outline output format includes an overall writing strategy and a chapter planning table. Before finalizing the outline file, the system locates the title "#Project Storybook Outline" in the model output, retaining only the title and the content following it. If locating the title fails, an error message is displayed and the process is terminated.
[0052] This step addresses the issue of the model potentially changing its chapter structure during end-to-end generation by imposing constraints on a fixed chapter structure, ensuring that the document structure produced in each run is completely consistent.
[0053] Step S6: Write in chapters;
[0054] The system calls the large language model for writing according to each independent chapter in the fixed chapter structure. The independent chapters include: "0 Project Introduction", "1.1 Cooperation Background", "1.2 Project Objectives", "1.3 Business Requirements", "1.4 Solution", "2.1 Results and Benefits", and "2.2 Customer Evaluation".
[0055] Each chapter uses the same chapter writing prompt template, but with different contexts—the chapter title to be written, the key facts and what should not be written in the chapter outline, and the full list of facts.
[0056] The prompts impose strict boundaries on the writing process: the language style must be objective, restrained, and direct; important facts must be followed by a source marker in parentheses (e.g., "(Source: Final Report Slide 20)"); psychological feelings, industry comparisons, judgments of severity, or causal relationships not clearly supported by the material must not be generated; and extreme adjectives are prohibited.
[0057] For the "0 Project Introduction" section, the prompt additionally requires the model to output five bolded tags line by line: project name, client name, project type, project implementation period, and contract amount, followed by a project overview of no more than 120 characters. For the "1.4 Solution" section, the prompt mandates that the model retain the solution design drawing in place and manually insert placeholder text.
[0058] This step avoids the problems of models tampering with their structure, fabricating facts, and using mixed terminology during end-to-end generation by writing chapters under the guidance of the outline and using a list of facts as the sole factual basis.
[0059] Step S7: Verification of definitive facts based on the fact list;
[0060] like Figure 3 As shown, the system calls the large language model chapter by chapter, submitting the full text of the chapter to be verified along with a complete list of facts. The prompts instruct the model, acting as a reviewer, to check each item in the chapter draft against the fact list for the following seven types of factual risks:
[0061] (1) The customer, amount, period, revenue or indicator not on the list appears; (2) The plan is written as if it has been completed; (3) Low confidence information is written as a certain fact; (4) The statements are inconsistent; (5) The unstated cause, frequency or severity is made as factual statements; (6) Exaggeration, emotional rendering or literary metaphor; (7) The causal relationship is established by means of "therefore", "leading to", "it can be seen" etc., which is not supported by evidence.
[0062] The standard format for validation output includes three parts: conclusion (pass / mostly pass requiring minor revisions / fail requiring rewrite), a table of identified issues, and highlights that can be retained.
[0063] This step transforms the review of generated content from model self-evaluation to item-by-item comparison based on structured factual documents, making the verification results deterministic and reproducible. This avoids the problem of random and unauditable verification conclusions caused by reliance on subjective model judgment in existing technologies.
[0064] Step S8: Chief editor revision based on verification feedback;
[0065] The system calls the large language model and submits all chapter drafts and corresponding verification results to the model. The model is required to complete the following tasks: (1) handle the transition between chapters and language consistency; (2) merge repeated facts; (3) delete emotional rendering, exaggerated embellishment, unfounded industry evaluations and unsupported causal relationships; (4) retain the manual insertion position for the solution design diagram in the "1.4 Solution" sub-chapter; (5) uniformly fill in the supplementary content to be manually confirmed in the "3.1 Project Pain Points" and "3.2 Project Highlights" sub-chapters; (6) sort out the information gaps in the "3.3 Other Supplements" sub-chapter.
[0066] Key Mechanism: Cue words force the model to prioritize validation comments. If a chapter's validation conclusion is "fail" and requires rewriting, the model must not simply copy the original draft but must reorganize the chapter's content around the fact list and validation comments. The final draft must retain at least one evidence marker (paragraph number or slide number) that can be mapped from the source index.
[0067] This step, together with step S7, forms a complete "writing → verification → revision" deterministic feedback loop, which solves the problem of the lack of an auditable mechanism in the verification process in the prior art.
[0068] Step S9: Final draft quality gate check and automatic retry;
[0069] like Figure 4As shown, the system calls a set of purely procedural quality inspection functions to perform the following deterministic checks on the initial draft of the project storybook: (1) Chapter structure integrity check - verifying whether the text contains exactly all fixed chapter titles, and the title hierarchy and order must be completely consistent with the regulations; (2) Manual confirmation boundary coverage check - verifying whether the main text of the sub-chapter “3.1 Project Pain Points” and “3.2 Project Highlights” only contains placeholder text to be added after manual confirmation; (3) Solution design diagram insertion position retention check - verifying whether the main text of the sub-chapter “1.4 Solution” contains the symbolic text of the manually inserted position of the solution design diagram; (4) Prohibited expression check - scanning the entire text through the keyword list; (5) Emotional expression check - detecting whether there are unfounded psychological feelings descriptions.
[0070] If all checks pass, the system officially saves the Markdown text as the final draft. If any check fails, the system compiles the detected issues into a problem summary, adds it to the editor-in-chief's revision prompts, calls the large language model for targeted revision, and performs a full quality check again on the revised text. If the revised text still fails the checks, the system stops the final draft output and saves the complete reports of both quality checks and the final unqualified Markdown draft to the audit directory.
[0071] This step achieves closed-loop quality assurance by using a programmatic quality detection function and automatically triggering model revision and retry when defects are detected. It automatically intercepts structural errors, factual inconsistencies, and stylistic violations before final delivery.
[0072] Step S10: Deterministic source index generation;
[0073] like Figure 4 As shown, the system iterates through all the main text of the final draft and identifies all source tags using regular expressions. The format of the source tags is standardized by the prompts used in the chapter writing and editing stages, with a typical format being "(source: filename location)".
[0074] For each identified source marker, the system performs a purely procedural deterministic mapping: extracting the filename and location information components from the marker, and performing a query and matching in the document parsing results and evidence fragment library generated in step S2. The matching strategies include: (1) precise filename matching; (2) location inference—locating the specific text paragraph in the parsing results of the corresponding file based on the location type (Slide number, paragraph number, etc.) in the marker; (3) original text excerpt backfilling—extracting the beginning part of the original text corresponding to the location (such as the first 80 characters) as the original text excerpt in the index entry.
[0075] The system compiles all successfully mapped source entries into an index document. For source tags that cannot be uniquely mapped, the system lists these tags separately in the final section of the index document awaiting manual confirmation. The entire process does not invoke the large language model; all mapping logic is programmatic string matching and index lookup.
[0076] This step achieves source tracing in a purely procedural manner. Its mapping accuracy is not affected by fluctuations in model behavior, and it can automatically identify and report unmappable reference entries. This solves the problem in existing technologies where source tracing relies on annotation during model generation and cannot achieve deterministic mapping.
[0077] Step S11: Automatic export of Word document (preferred implementation method);
[0078] The system uses the python-docx library to load predefined Word templates, parses the Markdown text paragraph by paragraph, and writes the parsed results into the corresponding positions in the Word document according to the template's style definitions. In a Windows environment with Microsoft Word installed, the system can optionally call the win32com library to automatically perform field refresh operations.
[0079] This step is the preferred implementation method, which solves the problem of one-click conversion from Markdown to a correctly formatted Word document.
[0080] It should be further noted that the list of inspection keywords for the quality inspection function set in step S9 is designed to be read from the configuration file, and the system administrator can add or adjust the inspection keywords by modifying the configuration file.
[0081] All large language model prompts are stored in a separate prompt directory. Each time the pipeline runs, the system automatically copies all currently used prompts to a snapshot subdirectory in the output directory of this run, providing complete audit trail capabilities for troubleshooting and iterative optimization.
[0082] The system uses a mutex lock to ensure that only one generation task is running at a time, preventing the input materials of different tasks from contaminating each other.
[0083] The following example illustrates the complete operation of this invention through a specific project implementation scenario.
[0084] A company's project management office needed to generate a project storybook for internal knowledge preservation for the recently completed "Phase I Customer Requirements Planning Project." The responsible personnel collected the following materials: a de-identified Project Work Statement (SOW, Word format, 26 pages), a de-identified internal project closure report (PowerPoint format, approximately 30 slides), and a de-identified project user manual (Word format). In these three documents, the SOW primarily describes the project's background, business requirements, preliminary solutions, and project objectives; the PowerPoint report records the delivered solution modules, deployment results, customer feedback, and some pain points and highlights that were not yet finalized; and the user manual provides a detailed description of the system's functions and user interface.
[0085] The personnel in charge placed the SOW document into two blocks: "Basic Information / Background Requirements" and "Solution / Delivery Process" (because the document involves both types of information), the project completion report into the "Results Evaluation / Pain Points and Highlights" block, and the user manual into the "Solution / Delivery Process" block. Before submission, the personnel in charge noted in the custom writing requirements: "The contract amount for this project is in the millions of yuan, and the client is in the consumer goods industry."
[0086] After system startup, all files are first parsed to generate text with paragraph / slide numbers; then, the text is sliced in 1800-character windows. Next, the system calls the large language model to extract slots for each block. The "Basic Information / Background Requirements" block extracts basic information such as project name, client name, and project timeline, and automatically categorizes the precise contract amount as "requires manual confirmation," with a note suggesting the use of a "million-level" caliber. The "Solution / Delivery Process" block extracts the functional module designs from the SOW and the actual system interface descriptions from the user manual. The "Results Evaluation / Pain Points and Highlights" block extracts the go-live metrics and client verbal feedback from the project completion report.
[0087] During the fact merging phase, when the system integrated the extraction results from the three blocks into a fact list, a conflicting statement was discovered: the Statement of Work (SOW) stated "target for improving prediction accuracy" as "improvement of 10%", while the actual verified metric in the final report was "monthly average accuracy improvement of 10.71%". The system automatically highlighted this discrepancy in the conflicting statements section of the fact list and suggested that the final draft should use the actual data from the final report, while also noting the original target statement from the SOW.
[0088] Subsequently, the system outlined the project according to a fixed chapter structure and wrote chapter by chapter. When writing "1.4 Solution," the model retained placeholder text for the solution design diagram within the chapter. During the fact-checking phase, the model detected unfounded emotionally charged statements in the "2.2 Customer Feedback" chapter, such as "The weighty expectations behind this simple approval," and judged it as "needing modification." In the final editing phase, the model deleted this sentence based on the feedback and standardized the customer feedback to direct quotes from the fact list. In the "3.1 Project Pain Points" and "3.2 Project Highlights" chapters, the model output "Pending manual confirmation by the project team" as required.
[0089] Before the final draft was uploaded, a procedural quality gate automatically checked the draft. The check found that: the chapter structure was complete, the manually confirmed boundaries were correct, the insertion points of the scheme diagrams were retained, and no prohibited words appeared—all check items passed. The system officially saved the final Markdown file, then called the Word exporter to generate a formatted docx document and generated a source index. The source index successfully mapped the marks in the text such as "(Source: Project Completion Report Slide 8)" and "(Source: Project Specification SOW Paragraph 15)" back to the corresponding positions and original text excerpts in the corresponding files, and the number of items awaiting manual confirmation was 0.
[0090] The entire process requires no manual intervention in text writing and fact-checking. The final project storybook is structurally sound, factually verifiable, compliant in style, and traceable in origin, and can be directly delivered to the business team for internal knowledge accumulation and case reuse.
[0091] Several key components and steps in the above specific embodiments can be implemented using corresponding alternative methods according to different application requirements or system architectures. While maintaining the core objective of this invention (i.e., generating high-quality, reliable documents from unstructured materials through the organic combination of business block-based material classification guidance, fact list-based deterministic verification closed loop, non-model-based deterministic source index, and programmatic quality verification control), feasible alternatives are provided below for several key steps.
[0092] Alternative Implementation Method 1: Dynamic Block Generation and Automatic Material Allocation Based on Unsupervised Clustering
[0093] As an alternative to the system's predefined three business block directories in step S1, a similar technical effect can be achieved by using dynamic block generation based on unsupervised clustering and automatic material allocation.
[0094] Specifically, the system first performs document parsing as described in step S2 on all input materials, vectorizing the text content of each document. Then, it automatically groups the material vectors using a clustering algorithm (such as K-Means or density-based clustering methods). The number of groups can be specified by the user or automatically determined by indicators such as the silhouette coefficient. Each cluster is considered a dynamically generated business block. After clustering, the system automatically assigns materials to the corresponding blocks and generates a summary label describing the content theme of each block (e.g., "Project Background and Contract Information," "Technical Solution and Delivery Details"), replacing the preset static block names.
[0095] In subsequent step S3, the system no longer uses three fixed sets of prompt words. Instead, it dynamically generates or selects a corresponding slot to extract prompt words based on the summary tag of each block, or injects the block summary as context into the general prompt words. This alternative implementation achieves the same technical effect as the present solution—divide and conquer extraction of materials according to business categories—the difference being that the responsibility for classifying business categories is shifted from explicit user basket sorting to system-assisted clustering.
[0096] Alternative Implementation Method Two: Multi-dimensional Tag-based Attribute Labeling as an Alternative to Exclusive Block Classification
[0097] As an alternative to the block definition in step S1 and the slot extraction prompts in step S3, multi-dimensional tag-style attribute labeling can be used to replace exclusive block classification, and users can customize the slot extraction through the interface.
[0098] This alternative implementation aims to address the common scenario where a single document contains multiple types of information, reducing the framework limitations when only one block can be selected. In terms of implementation, the file system's directory classification is replaced with a tag-based management module. Users can select one or more pre-defined attribute tags (e.g., "#Background", "#Requirements", "#Solution", "#Deliverables", "#Effect Evaluation", "#Pain Points") for each file on the document submission interface. When generating evidence fragments in step S2, each fragment inherits all tags from its parent file.
[0099] During slot extraction in step S3, the system no longer executes three independent calls for mutually exclusive blocks. Instead, it submits all evidence fragments in a single call and embeds the preprocessed tag information of each fragment (e.g., "[Fragment 001, Tag: #Background, #Requirement]") into the fragment reference format of the prompt words. The model is instructed to strictly extract the field content of the corresponding slot based on the tag context of the fragment—for example, extracting customer reviews only from fragments tagged "#Effect Evaluation" and avoiding mis-extraction from fragments tagged "#Solution".
[0100] Meanwhile, the slot field definition used in step S3 can be replaced by allowing users to dynamically configure it on the front end via a web interface: users can add, delete, or rename extraction fields, and the system dynamically assembles the extraction prompts for step S3 accordingly. This alternative approach is similar to the basket-based design with customized prompts in this solution in guiding the model to focus on the business context, but it provides finer-grained material organization and stronger user customization capabilities.
[0101] Alternative Implementation Method 3: Performing Fact Consistency Verification Using a Dedicated Natural Language Reasoning Model
[0102] As an alternative to the "deterministic verification and feedback revision closed loop based on the fact list" formed by steps S7 and S8, a dedicated natural language reasoning model can be used to perform fact consistency verification instead of a general large language model.
[0103] When performing validation tasks, the general-purpose large language model, despite being subject to the structured constraints of the prompts in step S7, may still exhibit slight uncertainty in its output conclusions under extreme conditions. In contrast, natural language reasoning models are discriminative neural network models specifically trained for the task of "given a premise (an item in the fact list), determine whether an assumption (a statement in the text) is true (implied / contradictory / neutral)."
[0104] In this alternative, the processing flow of step S7 is restructured as follows: (1) The post-processing system extracts each factual statement from each chapter draft to form a statement list; (2) For each statement, it is paired with all items in the fact list one by one, and sent as "assumption-premise" to the natural language reasoning model for reasoning; (3) If a statement contradicts all items in the list or cannot find an item with an implication relationship, the statement is marked as a high-risk factual error; (4) All high-risk statements are summarized to generate a structured verification report. The editorial model in step S8 is revised based on this deterministic report. This alternative can achieve similar technical effects to this solution, namely, establishing a deterministic verification mechanism for factual accuracy and feeding it back to the revision stage, and due to the discriminative characteristics of the natural language reasoning model, the consistency of the verification conclusion is theoretically better than that of the general generative large language model.
[0105] Alternative Implementation Method 4: Differentiated Retry Strategy Based on Defect Severity Grading
[0106] As an alternative to the one-retry restriction of "adding only one additional model call" in step S9, a differentiated retry strategy based on the severity of defects can be adopted to provide more flexible quality closed-loop control, avoid the entire high-quality manuscript generation task being terminated due to minor writing style issues, and also prevent meaningless repeated retries for fatal defects.
[0107] Specifically, in the set of procedural quality inspection functions in step S9, a severity level is predefined for each inspection item. For example, a lack of complete chapter structure is defined as a fatal level; failure of manual confirmation of boundary coverage is defined as an error level; and the presence of individual emotional expressions or non-serious prohibited words is defined as a warning level.
[0108] When a quality gate detects a problem, the system executes different automation strategies based on the highest severity level of the detection result: If the highest level is a warning, the system automatically injects the problem list into the editor's prompt, triggering a revision; after revision, it automatically passes again without interruption. If the highest level is an error, a revision is also triggered, but if the error or critical problem still exists after revision, output is stopped. If a critical problem is detected on the first test, the system directly stops output and records an audit report. This alternative solution, by introducing hierarchical quality control logic, achieves better process pass rates and automation rates while maintaining an automated closed loop.
[0109] Alternative Implementation Method 5: Fuzzy Matching Based on Edit Distance as a Source Index Fault Tolerance Method
[0110] As an alternative to the "exact string matching" that the "purely procedural deterministic mapping" in step S10 relies on, fuzzy matching based on edit distance can be introduced as an auxiliary fault-tolerance method.
[0111] During the generation and revision process in steps S7 and S8, although the prompt words are required to strictly follow the format "(Source: Filename Location)", the model may occasionally produce minor deviations in the writing of filenames or location numbers (e.g., an extra space, or "Slide" written as "Slide "). Pure exact matching will directly include such deviations in the "cannot be uniquely mapped" confirmation list, increasing the workload of manual verification.
[0112] In this alternative, when an exact match fails, the system does not immediately classify it as unmappable, but instead performs a second-stage fuzzy match. Specifically, the system calculates the Levenshtein edit distance between the text components in the target tag and all filenames and paragraph identifiers in the document parsing result database. Entries with edit distances below a preset threshold (e.g., 2 or 3) are considered candidate matches. For multiple candidate results, the system further combines the character offset range recorded in step S2 to perform position inference and selects the logically most probable match. Successful fuzzy matches are marked with their matching method in the source index to distinguish them from exact matches. Only when both exact and fuzzy matches fail is the entry added to the pending confirmation list. This alternative effectively improves the robustness of source tracing and the automatic matching rate, while reducing manual intervention.
[0113] Alternative Implementation Method Six: Configurable Rule Engine and Statistical Quality Scoring System
[0114] As an alternative to executing all checks with a "purely procedural set of quality inspection functions" in step S9, a configurable rule engine and statistical quality scoring system can be used to upgrade quality gating from a set of static, hard-coded checks to a flexible, continuously monitored, and optimized quality assurance system.
[0115] The implementation involves decoupling the definitions of all inspection items (chapter structure regular expressions, boundary text rules, keyword blacklists, etc.) from the program code and storing them in an external structured configuration file (such as YAML or JSON format). The programmatic quality gate loads this configuration file at startup, forming a dynamically parsed rule engine.
[0116] Furthermore, the system no longer simply outputs a binary "pass / fail" conclusion, but instead assigns weights and deduction values to each rule. Upon completion of the inspection, the system aggregates the deduction values of all triggered rules to calculate an overall quality score for the final draft. The decision logic then determines subsequent actions based on the threshold range the quality score falls into: for example, a score above 90 is considered pass; between 80 and 90, a lightweight, prompt-guided polishing revision is triggered (without forcing a full rewrite); between 70 and 80, standard feedback plus a revision process is triggered; and below 70, the process is terminated directly, and a detailed audit report of the scoring is output. This alternative achieves the same or even better technical results—automatically and precisely intercepting quality issues and extending quality assurance from reactive firefighting to measurable continuous improvement.
[0117] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system 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 system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0118] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0119] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a multimedia terminal device (which may be a mobile phone, computer, television receiver, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0120] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for automated document generation based on multi-stage fact extraction and verification, characterized in that, Includes the following steps: Step S1, Input material classification and organization based on business blocks: The system predefines multiple business block directories, each of which corresponds to a business category, to guide users to store input materials according to business categories; The system traverses the directories of each business block to find input files, records the file name, the block list to which each file belongs, and the source description of each file, and generates an input material list. Step S2, Document Parsing and Evidence Slicing: The system selects the corresponding parser according to the file extension, parses each input file, extracts the text and records the position index, which is the paragraph number or slide number; then, according to the preset segment length and overlap, the system performs sliding window slicing on the full text of each parsed document to generate evidence segments. Each evidence segment includes the source file path, segment number, the start and end character offsets in the original text, and the sliced text content. Step S3, slot extraction customized according to business blocks: The system configures independent slot extraction prompts for each business block. Each slot extraction prompt defines the extraction slot and output format specific to that business block. The system calls the large language model to perform structured slot extraction based on the evidence fragments under each business block and the corresponding slot extraction prompts, generating the slot extraction results for each business block. Step S4, Fact List Merging: The system calls the large language model to merge the slot extraction results of each business block into a unified fact list. During the merging process, the following processing is automatically performed: duplicate records of the same fact appearing in multiple blocks are deduplicated and all evidence sources are retained; conflict marking is performed on different blocks that have different statements on the same fact, and conflict statement chapters are established in the fact list. For preset slots where no corresponding facts are found in all blocks, gap identification is performed, and an information gap section is created in the fact list; Step S5, Outline Planning: The system calls the large language model to plan the outline of the final document based on the fact list. The outline must strictly follow the preset fixed chapter structure. No chapter titles may be added, deleted, or modified. The fixed chapter structure includes at least the following chapters: Project Introduction, Project Content, Project Achievements, Project Summary, Solution, and Boundary Confirmation. Step S6, Chapter-by-Chapter Writing: The system calls the large language model to write for each independent chapter in the fixed chapter structure. The writing of each chapter is based solely on the fact list, and the source is marked in parentheses after important facts. Step S7, Deterministic Fact Verification Based on Fact List: The system calls the large language model chapter by chapter, submits the full text of the chapter to be verified and the complete fact list together, and checks the chapter draft item by item against the fact list to see if there are any factual risks. The system outputs the verification conclusion and the list of problems found. The verification conclusion includes pass, basically pass (minor revision required) or fail (rewrite required). Step S8, Chief Editor Revision Based on Verification Feedback: The system calls the large language model and submits all chapter drafts and corresponding verification results together. The model must prioritize processing verification comments. For chapters that fail verification and need to be rewritten, the model must not copy the original draft, but must reorganize the chapter content based on the fact list and verification comments to generate a complete first draft of the project storybook. Step S9, Final Draft Deterministic Quality Gate Check and Automatic Retry: The system calls a set of purely procedural quality inspection functions to perform deterministic checks on the initial draft of the project storybook. These checks include at least a chapter structure integrity check, a manual confirmation boundary coverage check for manually confirmed boundary chapters within the fixed chapter structure, a solution design diagram insertion point retention check for solution chapters within the fixed chapter structure, and a prohibited expression check. If all checks pass, the initial draft of the project storybook is officially saved as the final draft. If any check fails, the system compiles the detected issues into a problem summary, adds it to the prompts in the chief editor's revision stage, calls the large language model for targeted revision, and performs all quality checks again on the revised text. If it still fails, the output is stopped and an audit record is generated. Step S10, Deterministic Source Index Generation: The system traverses all the main text of the final draft and identifies all the source markers using regular expressions. For each identified source marker, the filename and location information are extracted and matched against the document parsing results and evidence fragment library generated in step S2. Through programmed string matching and location inference, the source marker is definitively mapped back to the original file, paragraph or slide number, and original text excerpt. For source markers that cannot be uniquely mapped, they are listed separately as chapters awaiting manual confirmation.
2. The document automated generation method based on multi-stage fact extraction and verification according to claim 1, characterized in that, In step S3, the system pre-writes independent slot extraction prompts for each of the three business blocks, which correspond to the three business categories of "basic information / background requirements", "solution / delivery process" and "results evaluation / pain points and highlights". The slots in the "Basic Information / Background Requirements" block include: Customer Name, Project Name, Project Type, Project Duration, Contract Amount, Project Background, Project Objectives, and Business Requirements. The slots in the "Solution / Delivery Process" block include: overall solution, solution module list, delivery phases and milestones, and key deliverables; The slots in the "Results Evaluation / Pain Points and Highlights" block include: project results, customer evaluations, candidate project pain points, and candidate project highlights.
3. The document automated generation method based on multi-stage fact extraction and verification according to claim 1, characterized in that, In step S3, the slot extraction prompts clearly stipulate that only information explicitly appearing in the evidence fragments can be used, and fabricated customer reviews, revenue figures, amounts, or periods are not allowed; the source of evidence must be written in a locatable form, including the file name, slide number or paragraph number, and evidence ID; if the same fact is inconsistent in different sources, it must be written that manual confirmation is required; the slot extraction result file for each business block includes a structured table organized by the slots specific to that block, as well as three summary areas: "Reliable Facts Found", "Information That May Require Manual Confirmation", and "Missing Information".
4. The document automated generation method based on multi-stage fact extraction and verification according to claim 1, characterized in that, In step S4, the merging logic of the fact list is executed sequentially according to the preset slot grouping, and includes four fixed parts: the first part is the basic project information, merging the customer name, project name, project type, project cycle, and contract amount; the second part is the project background, objectives, and business requirements; the third part is the solution and delivery process; and the fourth part is the project results, evaluation, pain points, and candidate highlights. The output format of each part includes four fields: "Confirmed Facts," "Source of Evidence," "Confidence Level," and "Remarks." The conflict caliber section records the conflict points, the sources of different calibers, and suggested manual handling methods. The information gap section records the impact of missing information on document generation and suggested directions for supplementary materials.
5. The document automated generation method based on multi-stage fact extraction and verification according to claim 1, characterized in that, In step S5, the fixed chapter structure specifically refers to: The "0 Project Introduction" section serves as the project introduction section. The "1 Project Content" section, as the project content section, includes the subsections "1.1 Cooperation Background", "1.2 Project Objectives", "1.3 Business Requirements", and "1.4 Solutions", wherein the "1.4 Solutions" subsection is the solution section; The "2 Project Results" section, which is the project results section, includes the subsections "2.1 Results and Benefits" and "2.2 Customer Feedback"; The "3 Project Summary" section, as the project summary section, includes the subsections "3.1 Project Pain Points", "3.2 Project Highlights", and "3.3 Other Supplements", wherein the subsections "3.1 Project Pain Points" and "3.2 Project Highlights" are the manually confirmed boundary sections; The outline output format includes an overall writing strategy and a chapter planning table. Each row of the chapter planning table corresponds to a fixed chapter, containing the questions to be answered in this chapter, key facts from specific fact items in the fact list, and three columns indicating what should not be written. The sub-chapters "3.1 Project Pain Points" and "3.2 Project Highlights" are only planned for manual confirmation and supplementation, and the model should not be allowed to summarize them automatically. The sub-chapters "1.4 Solutions" must have at least one space for inserting a manual solution design diagram. Before the final outline file is uploaded to disk, the system locates the title "#Project Storybook Outline" in the model output and only retains the title and the content after it. If the location fails, an error is reported and the process is stopped.
6. The document automated generation method based on multi-stage fact extraction and verification according to claim 1, characterized in that, In step S6, the system calls the large language model to write for each independent chapter in the fixed chapter structure. The independent chapters include: "0 Project Introduction" chapter, "1.1 Cooperation Background" sub-chapter, "1.2 Project Objectives" sub-chapter, "1.3 Business Requirements" sub-chapter, "1.4 Solution" sub-chapter, "2.1 Results and Benefits" sub-chapter, and "2.2 Customer Evaluation" sub-chapter. Each chapter uses the same chapter writing prompt template, but is infused with different contexts. These contexts include the chapter title to be written, the key facts and what should not be written in the outline, and the full text of the complete list of facts. The source tag format is "source: filename location". For the "0 Project Introduction" chapter, the model is required to output five bolded tags line by line: project name, client name, project type, project implementation period, and contract amount, followed by a project overview of no more than 120 words. For the "1.4 Solution" sub-chapter, the model is required to retain the solution design drawing and manually insert placeholder text in its original position.
7. The document automated generation method based on multi-stage fact extraction and verification according to claim 1, characterized in that, In step S7, the factual risks include the following seven categories: The first category includes customers, amounts, periods, revenues, or metrics that are not listed in the fact list. The second type involves writing the plan as if it had already been completed. The third category involves writing low-confidence information as certain facts; The fourth category has inconsistent diameters at the beginning and end; The fifth category includes factual statements regarding unspecified causes, frequency, and severity. The sixth category includes exaggerated embellishments, emotional rendering, or literary metaphors; The seventh category establishes a causal relationship that is not supported by evidence by using phrases such as "therefore," "leads to," or "is visible." The standard format of the verification conclusion includes three parts: verification conclusion, a table of problems found, and highlights that can be retained. The table of problems found lists the problems, their original location or wording, the reasons for the risks, and suggestions for modification. The highlights that can be retained are limited to the evaluation writing style and the use of evidence.
8. The document automated generation method based on multi-stage fact extraction and verification according to claim 1, characterized in that, In step S8, the editor-in-chief revision also requires the model to complete the following tasks: handle the transition between chapters and language consistency; merge recurring facts to ensure that the same indicator or evaluation is fully developed in only one place; remove emotional rendering, exaggerated embellishments, unfounded industry evaluations, and unsupported causal relationships; retain the manual insertion space for the solution design diagram in the "1.4 Solutions" sub-section; uniformly fill in the supplementary content to be manually confirmed in the "3.1 Project Pain Points" and "3.2 Project Highlights" sub-sections; sort out the information gaps in the "3.3 Other Supplements" sub-section; the final draft must retain at least one evidence marker that can be mapped by the source index, and the evidence marker is the paragraph number or slide number.
9. The document automated generation method based on multi-stage fact extraction and verification according to claim 1, characterized in that, In step S9, the deterministic check also includes an emotional expression check; The chapter structure integrity check verifies whether the text contains exactly all the chapter titles in the fixed chapter structure, and whether the title level and order are completely consistent with the provisions of the fixed chapter structure. The manual confirmation boundary coverage check verifies whether the main text of the "3.1 Project Pain Points" and "3.2 Project Highlights" subsections contains only placeholder text to be supplemented or equivalent after manual confirmation, and must not contain any pain points or highlights summarized by the model itself; The insertion point retention check verifies whether the main text of the "1.4 Solution" subsection contains any text indicating a manually inserted insertion point in the design diagram. The prohibited expression check scans the entire text using a keyword list to detect whether pre-configured prohibited words or phrases appear. The emotional expression check detects whether there are any unfounded descriptions of psychological feelings. If the revised version still fails the inspection, the system will not generate the final draft. Instead, it will save the complete reports of both quality checks and the final unqualified draft into the audit directory and indicate in the audit report that "the final draft quality gate failed".
10. A document automation generation system based on multi-stage fact extraction and verification, used to implement the document automation generation method based on multi-stage fact extraction and verification as described in claim 1, characterized in that, include: The input material classification module is used to predefine multiple business block directories, guide users to store input materials according to business categories, traverse each business block directory to find input files, record the file name, block list to which each file belongs and source description, and generate an input material list. The document parsing and evidence slicing module is used to select the corresponding parser according to the file extension to parse each input file, extract the text and record the position index, which is the paragraph number or slide number. The module also performs sliding window slicing on the full text of each parsed document according to the preset segment length and overlap to generate evidence segments. Each evidence segment includes the source file path, segment number, the start and end character offsets in the original text, and the sliced text content. The slot extraction module is used to configure independent slot extraction prompts for each of the business blocks. Each slot extraction prompt defines the extraction slot and output format specific to that business block. The module calls a large language model to perform structured slot extraction based on the evidence fragments under each business block according to the corresponding slot extraction prompts, and generates the slot extraction results for each business block. The fact list merging module is used to call the large language model to merge the slot extraction results of each business block into a unified fact list. During the merging process, it automatically performs deduplication and retains all evidence sources, marks conflicting statements and establishes conflicting statement chapters, and identifies gaps and establishes information gap chapters. The outline planning module is used to call the large language model to plan the outline of the final document based on the fact list. The outline strictly follows the preset fixed chapter structure and chapter titles cannot be added, deleted or modified. The fixed chapter structure includes at least a project introduction chapter, a project content chapter, a project results chapter, a project summary chapter, a solution chapter and a manually confirmed boundary chapter. The chapter-based writing module is used to call the large language model to write for each independent chapter in the fixed chapter structure. The writing of each chapter is based solely on the fact list, and the source is marked in parentheses after important facts. The deterministic fact verification module is used to call the large language model chapter by chapter, submit the full text of the chapter to be verified and the complete fact list together, and check the chapter draft item by item against the fact list to see if there are any factual risks. It outputs the verification conclusion and the list of problems found. The verification conclusion includes pass, basically pass (minor revision required) or fail (rewrite required). The chief editor revision module is used to call the large language model to submit all chapter drafts and corresponding verification results together. The model must prioritize processing the verification comments. For chapters that fail the verification and need to be rewritten, the model must not copy the original draft, but must reorganize the content of the chapter based on the list of facts and the verification comments to generate a complete first draft of the project storybook. The deterministic quality gate check module is used to call a set of purely procedural quality inspection functions to perform deterministic checks on the initial draft of the project storybook. The deterministic checks include at least a chapter structure integrity check, a manual confirmation boundary coverage check for the manually confirmed boundary chapters in the fixed chapter structure, a solution design diagram insertion position retention check for the solution chapters in the fixed chapter structure, and a prohibited expression check. If all checks pass, the initial draft of the project storybook is officially saved as the final draft. If any check fails, the specific problems detected are compiled into a problem summary and added to the prompts in the chief editor's revision stage. A targeted revision is then performed by calling a large language model. All quality checks are performed again on the revised text. If it is still unqualified, the output is stopped and an audit record is generated. The deterministic source index generation module is used to traverse all the main text of the final draft, identify all the source markers through regular expressions, extract the file name and location information components of each identified source marker, and perform query matching in the document parsing results and evidence fragment library generated by the document parsing and evidence slicing module. Through programmed string matching and location inference, the source markers are deterministically mapped back to the original file, paragraph or slide number and original text excerpt. Source markers that cannot be uniquely mapped are separately listed as chapters awaiting manual confirmation.
