Large language model paragraph-by-paragraph accurate report generation method and system

The triplet configuration package, which uses tree node binding and version locking mechanisms, solves the problems of data misalignment, causal logic breakage, and token redundancy in the generation of large language model reports. It achieves efficient, deterministic, and auditable report generation, and supports partial updates and compliance requirements.

CN122491243APending Publication Date: 2026-07-31DATANG SOFTWARE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-09
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing large language model report generation technologies suffer from problems such as high data reference misalignment rates, disordered generation order leading to broken causal logic, redundant parent node inputs resulting in token waste, unreproducible randomness of generated results, and the need for full-text regeneration for partial updates. These issues fail to meet the compliance requirements of government reports for auditability, reproducibility, and traceability.

Method used

By parsing the report template into tree-like paragraph nodes, persistently binding data slots and prompt word templates, using a triplet configuration package, and a forced causal order generation method, leaf nodes generate content first and then summarize, parent nodes only depend on child summaries, setting a version lock mechanism to ensure the generation order, realizing causal chain integrity verification, and supporting hot reloading updates.

Benefits of technology

It achieves significant improvements in data accuracy, increased matching rate of generation logic, improved resource efficiency, reduced token consumption, enhanced determinacy and reproducibility of generation results, supports minute-level hot reloading, meets compliance requirements, and significantly improves update efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122491243A_ABST
    Figure CN122491243A_ABST
Patent Text Reader

Abstract

This invention relates to the field of natural language processing and intelligent document generation technology, and discloses a method and system for generating accurate reports segment by segment using a large language model. The invention splits the report into tree-like segment nodes, persistently binding JSON data slots and prompt word templates to each node, forming a hot-loadable triplet structure. Version dependency locking enforces an irreversible flow of "leaf content → leaf summary → parent aggregation → root node." Parent nodes only use child node summaries, significantly reducing token consumption. The use of temperature=0, fixed seeds, and version chain management ensures completely deterministic results. It effectively solves problems such as data misalignment, causal confusion, resource waste, random results, and inability to hot-update, offering advantages such as accuracy, efficiency, determinism, auditability, and hot-updateability. It is suitable for the automatic generation of long text reports with high compliance requirements in government, research, and other fields.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing and intelligent document generation technology, specifically to a method and system for generating accurate reports segment by segment using a large language model. Background Technology

[0002] With the rapid development of large language model technology, using large language models to automate report generation has become an important direction for the digital transformation of enterprises and institutions. Government departments, financial institutions, and research institutions need to compile a large number of monthly, quarterly, and annual analytical reports every year. Traditional manual writing suffers from problems such as low efficiency, high cost, error-proneness, and long cycle time.

[0003] Existing large language model report generation technologies generally suffer from dual defects at the architectural and process levels, resulting in uncontrollable quality of long text generation:

[0004] 1) Architectural defects: paragraphs, business data, and prompt word templates are loosely coupled, have no persistent binding relationship, have a high data reference misalignment rate, and cannot achieve local hot updates and version tracking;

[0005] 2) Process layer defects: The generation order is chaotic, and the summary-first or parallel generation method is generally adopted, which disrupts the natural causal chain of "facts → summary → aggregation → conclusion", resulting in logical breaks and information distortion;

[0006] 3) Resource layer defects: The parent node directly depends on the full text input of the child node, resulting in a large amount of token redundancy, high cost and easy to trigger length limit;

[0007] 4) Compliance layer defects: The generated results are random and inconsistent with the prompts, failing to meet the compliance requirements of government reports to be auditable, reproducible, and traceable.

[0008] Existing mainstream solutions, including full-text one-time prompt generation, template variable replacement generation, and knowledge graph-based generation, cannot simultaneously solve the five core problems of data accuracy, causal rigor, resource efficiency, result certainty, and partial hot update capability.

[0009] To address the aforementioned issues, this application proposes a method and system for generating accurate segment-by-segment reports based on a large language model. Summary of the Invention

[0010] The purpose of this invention is to provide a method and system for generating accurate segmented reports for large language models, in order to solve the problems mentioned in the background art, such as high data reference misalignment rate, disordered generation order leading to causal logic breakage, redundant parent node input leading to token waste, random and unreproducible generation results, and the need for full text regeneration and inability to hot-load when local updates are required.

[0011] To achieve the above objectives, the present invention provides the following technical solution: a method for generating accurate segment-by-segment reports for a large language model, the method comprising the following steps:

[0012] a. Parse the report template into a tree-like collection of paragraph nodes, and persistently bind a unique data slot and prompt word template to each node to form a hot-loadable triplet configuration package;

[0013] b. For leaf nodes, first call the large language model to generate paragraph content and store the first version, then extract the summary sentence from the content and store the second version. The order of the two calls is forcibly guaranteed by the version lock mechanism.

[0014] c. For the parent node, collect the summary sentence versions of all child nodes and verify the integrity of dependencies. Only aggregate the child summaries and inject them into the parent node prompt word template to generate the parent content. The parent node prompt words do not contain the full text of the child nodes.

[0015] d. Recursively execute step c until the root node, and finally check the integrity of the causal chain during aggregation, blocking the output of missing dependencies.

[0016] Furthermore, the data slots in the triplet configuration package are JSON structures, and the field names and prompt word template variables are dynamically bound using double curly braces {{}}, supporting hot reloading and updates.

[0017] Furthermore, leaf node generation involves two large language model calls. The input to the second summary extraction call must include the output of the first content generation call, and the order is enforced by a version lock mechanism.

[0018] Furthermore, the number of input tokens for the parent node = the sum of the number of digest tokens for all child nodes + the number of data slot tokens for the parent node, thus minimizing token redundancy.

[0019] Furthermore, the version dependency lock mechanism listens for child node summary version change events, automatically marks the parent node as pending update, and records the chain dependency relationship.

[0020] Furthermore, the causal chain integrity check function traverses all leaf nodes and checks whether their summary versions have been aggregated to the root node level by level. If missing, it blocks the report output.

[0021] Furthermore, a system for generating accurate segment-by-segment reports for large language models is proposed. The system applies the method for generating accurate segment-by-segment reports for large language models as described in any one of claims 1 to 6. The system is characterized by comprising a template parsing engine, a data governance engine, a triple binding engine, a recursive generation scheduler, a version dependency lock manager, an LLM interface encapsulation module, a version chain manager, and a causal chain verifier.

[0022] Furthermore, it supports deployment on cloud servers and private servers, receives generation requests via API interface with a response time of less than 3 seconds, and supports hot reloading of configuration packages with zero restart.

[0023] Compared with the prior art, the beneficial effects of the present invention are:

[0024] This invention employs a collaborative mechanism of mandatory binding via triples and causal order control. When a node binds to a data slot and a prompt template, it simultaneously registers the causal order type ("leaf_content→abstract" or "parent_aggregation"). The triple storage structure includes a causal_type field, which determines the execution order and dependencies of the node within the process layer. Architectural binding defines the process order, avoiding human configuration errors and ensuring 100% system self-consistency.

[0025] This invention establishes a strong dependency between content-summary dual API calls and version locking. Leaf nodes must first call the generate_content() API and store version v1. Only after locking can they call the extract_abstract() API to generate summary v2. Key protection points: Implemented through the version_lock mechanism: When content is not ready, the abstract calling thread is blocked and returns a dependency_not_ready state; enforce the causal iron law of "no content, no summary" to prevent logical inversion.

[0026] This invention achieves optimal cost-quality by setting the parent node to rely solely on child summary aggregation and optimal token compression. The parent node prompt input is strictly limited to Σ(child.abstract), with a length ≤ number of characters × number of child nodes, and absolutely does not include child node.content. The token compression formula is defined as: parent_input_tokens = Σ(len(child.abstract)) + len(parent.dataslot). This significantly reduces token resource consumption, while the generation of parent nodes through child summary aggregation greatly improves the quality of generated content, achieving an optimal balance between cost and quality.

[0027] This invention achieves automatic version dependency propagation and causal chain integrity verification. When the abstract version of a child node changes from vN to vN+1, it automatically triggers a parent node version dependency update event, and the parent node's state is marked as "stale". The dependency relationship is stored as a chain structure: parent.deps=[{"node_id":"child", "abstract_version":"vN+1"}]. Integrity verification is performed before the root node is generated. This enables automatic change detection and propagation, 100% version consistency, and supports auditing to trace the data source of any conclusion. Attached Figure Description

[0028] Figure 1 This is an overall architecture diagram of the method and system for generating accurate segment-by-segment reports based on a large language model, as described in this invention.

[0029] Figure 2 This is a schematic diagram illustrating the binding of tree-like paragraph nodes and triples in a method and system for generating accurate paragraph reports from a large language model according to the present invention.

[0030] Figure 3 This is a sequence diagram of the recursive generation process of a method and system for generating accurate reports segment by segment based on a large language model, as described in this invention.

[0031] Figure 4 This is a flowchart illustrating the leaf node content generation process of a method and system for generating accurate segmented reports from a large language model, as described in this invention.

[0032] Figure 5 This is a flowchart illustrating the parent node aggregation generation process of a method and system for generating accurate segment-by-segment reports for a large language model, as described in this invention. Detailed Implementation

[0033] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0034] Please see Figures 1-5 This invention provides a technical solution: a method for generating accurate segment-by-segment reports from a large language model, the method comprising the following steps:

[0035] a. Parse the report template into a tree-like collection of paragraph nodes, and persistently bind a unique data slot and prompt word template to each node to form a hot-loadable triplet configuration package;

[0036] b. For leaf nodes, first call the large language model to generate paragraph content and store the first version, then extract the summary sentence from the content and store the second version. The order of the two calls is forcibly guaranteed by the version lock mechanism.

[0037] c. For the parent node, collect the summary sentence versions of all child nodes and verify the integrity of dependencies. Only aggregate the child summaries and inject them into the parent node prompt word template to generate the parent content. The parent node prompt words do not contain the full text of the child nodes.

[0038] d. Recursively execute step c until the root node, and finally check the integrity of the causal chain during aggregation, blocking the output of missing dependencies.

[0039] It should be noted that the specific steps for binding tree paragraph nodes to triples are as follows:

[0040] Step Sa: Establishing the node hierarchy

[0041] The system identifies the heading levels in the report template through layout analysis (e.g., "1. Risk Analysis" is the first level, and "1.1 Supply Chain Risk" is the second level).

[0042] Establish parent-child relationship pointers: Each non-root node records a parent_id pointing to its parent node, while the root node's parent_id is null;

[0043] Establish depth marking: root node depth=0, depth+1 for each level below, used for subsequent aggregation sorting.

[0044] Step Sb: Node type tag

[0045] Leaf node: A node with no child nodes, marked with type="leaf", responsible for generating the original content;

[0046] Parent node: A node with child nodes, marked with type="parent", responsible for summary aggregation;

[0047] Root node: The node with depth=0, marked with type="root", is responsible for the final report synthesis.

[0048] Step Sc: One-to-one binding of data slots

[0049] Each leaf node is bound to an independent data slot (DataSlot), which is a JSON object containing all the structured data required for that paragraph;

[0050] Data slot fields are named using camelCase or underscore (e.g., riskValue or risk_value), and must strictly correspond to the variable placeholders in the prompt word template.

[0051] Data slots support incremental updates: when business data changes, only the data slots of the corresponding nodes are updated, triggering version updates for that node and its ancestor nodes, while sibling nodes are unaffected.

[0052] Step Sd: Prompt template binding and variable mapping

[0053] Each node is bound to a prompt template (PromptTemplate), which includes:

[0054] system_prompt: Defines the LLM role (e.g., "You are a senior industry analyst, strictly based on data output, and fabrication is prohibited").

[0055] user_prompt: Contains generation instructions for variable placeholders (such as {{industry}}, {{risk_value}});

[0056] Variable binding mechanism: The system uses regular expressions to match {{variable}} in user_prompt and establishes a dynamic mapping relationship with the same-named field in data_slot;

[0057] Tip template reuse: Nodes of the same type (such as all leaf nodes of the "Risk Analysis" category) can reuse the same tip template, and personalized content can be achieved through data slot differentiation.

[0058] Step Se: Triple persistent storage structure

[0059] Example of triple storage structure in a database:

[0060] CREATE TABLE triple_store (

[0061] node_id VARCHAR(64) PRIMARY KEY,

[0062] parent_id VARCHAR(64),

[0063] node_type ENUM('leaf', 'parent', 'root'),

[0064] depth INT,

[0065] data_slot LONGTEXT,

[0066] prompt_template LONGTEXT,

[0067] causal_type VARCHAR(32), --such as 'leaf_content' or 'parent_aggregation'

[0068] current_version VARCHAR(16),

[0069] created_at TIMESTAMP,

[0070] updated_at TIMESTAMP );

[0072] This invention features a complete architecture with triple binding, significantly improving data accuracy; a correct process with enforced causal order, greatly improving logical matching rate; high resource efficiency, reducing local update time to the second level without rerunning the entire text; it achieves both token compression and quality assurance, reducing token consumption through parent node input while achieving Pareto optimality in cost and quality through high-quality digest aggregation; it combines deterministic generation with version tracking, with temperature=0 and a fixed seed ensuring determinism in single generation; the version chain records complete dependency paths, ensuring 100% reproducibility and audit compliance readiness; it is maintainable with automatic version propagation, significantly improving update efficiency; and it offers flexible deployment with hot-loading configuration, supporting minute-level hot loading, and significantly improving template configuration and iteration efficiency.

[0073] Hot reloading support: Triple data is stored in an in-memory database (Redis) + a persistent database (MySQL). When configuration changes occur, the scheduling layer is notified via a message queue (MQ), enabling hot updates with zero restart.

[0074] The data slots in the triplet configuration package are JSON structures, and the field names and prompt word template variables are dynamically bound using double curly braces {{}}, supporting hot reloading and updates.

[0075] Leaf node generation involves two large language model calls. The input to the second summary extraction call must include the output of the first content generation call, and the order is enforced by a version lock mechanism.

[0076] The number of input tokens for the parent node = the sum of the number of digest tokens for all child nodes + the number of data slot tokens for the parent node, thus minimizing token redundancy.

[0077] The version dependency lock mechanism listens for child node summary version change events, automatically marks the parent node as pending update, and records the chain dependency relationship.

[0078] The causal chain integrity check function traverses all leaf nodes and checks whether their summary versions have been aggregated to the root node level by level. If they are missing, the report output is blocked.

[0079] It should be noted that: Phase 1: Initialization and triplet construction (T0-T4)

[0080] T0-T1: Template Parsing

[0081] Users upload report template files (DOCX) through the front-end interface;

[0082] The template parsing engine performs layout analysis, identifies visual features such as heading level, font size, and indentation, and constructs a node tree.

[0083] The node tree is returned in JSON format, containing the complete parent-child relationship chain.

[0084] T2-T4: Data Governance and Triple Binding

[0085] Users configure data governance rules (e.g., SQL: SELECT industry, risk_value FROM market_data WHERE date='2024Q1').

[0086] The data governance engine executes rules, extracts structured data, and populates it into the data slot pool.

[0087] The system performs triple binding: it assigns a data_slot and a prompt_template to each node, forming a (node_id, data_slot, prompt_template) triple;

[0088] The triple is persisted to the Triple Store, with the initial version marked as v0 and the status "unready".

[0089] Phase 2: Forced generation of causal order (T5-T20)

[0090] T5-T9: Leaf node content generation (forced order: content before summary)

[0091] The recursive scheduler starts a post-order traversal, first visiting the leaf nodes (such as node_id="1_1_1").

[0092] Version dependency lock check: Check if the data_slot of the leaf node is filled (status: ready). If ready, unlock and proceed to the generation process.

[0093] First LLM call (content generation):

[0094] Input: system_prompt (role settings) + user_prompt (including variables such as {{industry}}, which have been replaced with data slot values);

[0095] Parameters: temperature=0 (eliminate randomness), seed=42 (ensure reproducibility), max_tokens=2048;

[0096] Output: Paragraph (paragraph content, approximately 500-800 words);

[0097] Version Chain Storage (v1): Store the Paragraph in the Version Chain, marked as content_v1, and record the generation timestamp and input parameter hash.

[0098] T10-T14: Leaf Node Summary Extraction (Forced Order: Summary Depends on Content)

[0099] Synchronous blocking mechanism: The system forces the system to wait for the result of step T9 to return, and uses Paragraph as the input parameter;

[0100] Leaf summary nodes, such as node_id="1_1";

[0101] Second LLM call (digest extraction):

[0102] Input: Paragraph full text + abstract extraction command ("Please extract approximately 50-100 words of core abstract from the above paragraph");

[0103] Output: Abstract (abstract sentence / paragraph, 50-100 words);

[0104] Version Chain Storage (v2): Store Abstract in Version Chain, mark it as abstract_v2, and record the dependency relationship dependencies=[{"node":"1_1_1", "content":"v1"}], establishing a causal link with content_v1.

[0105] T15-T19: Parent node aggregation generation (forced order: parent node depends on child digest)

[0106] The recursive scheduler traverses upwards to the parent node (e.g., node_id="1");

[0107] Version dependency lock check: Query the Version Chain to check whether the abstract_version of all child node summaries (such as "1_1" and "1_2") has been generated and is in the "ready" state;

[0108] If any child node's abstract is not ready, the parent node's task enters the blocking queue, waiting for the child node's generation event to be triggered.

[0109] If all child nodes are ready in abstract (e.g., "1_1":v2, "1_2":v3), then unlock and proceed to the generation process;

[0110] Sub-abstract aggregation: Extract the latest abstract of all child nodes from the Version Chain and concatenate them into a Context string (format: "sub-node 1 abstract: xxx; sub-node 2 abstract: yyy").

[0111] Token compression implementation: The parent node prompt only contains the Context (Σ sub-digest, about 100-200 words), and does not contain the complete content of the child nodes (otherwise it would be up to 1000-1600 words), thus achieving significant token compression;

[0112] First LLM call (parent content generation): Input the parent node prompt_template + Context, generate Parent Content;

[0113] Second LLM call (Parent Abstract Extraction): Input Parent Content, generate Parent Abstract;

[0114] Version chain storage (vX): Stores parent content vX and parent summary vY, and records dependencies=[{"node":"1_1", "abstract":"v2"}, {"node":"1_2", "abstract":"v3"}).

[0115] T20: Recursively proceed until the root node

[0116] Repeat steps T15-T19, recursively going upwards layer by layer, until the root node (node_id="0") is reached.

[0117] The root node also performs the sub-summary aggregation → content generation → summary extraction process to generate the final report summary.

[0118] Phase 3: Integrity Verification and Output (T21-T23)

[0119] T21: Causal chain integrity verification

[0120] After the root node is generated, the causal chain validator performs a full-link check:

[0121] Traverse all leaf nodes to confirm that their abstract_version has been passed to the root node through the dependency chain;

[0122] Check version consistency: Confirm that all sub-digest versions referenced in the root node's dependencies are latest and there are no expired versions;

[0123] Check isolated nodes: confirm that there are no leaf nodes that did not participate in aggregation;

[0124] Verification results:

[0125] If it fails: throws a CausalChainBrokenError, returns the list of missing nodes, and blocks report output;

[0126] If successful: Proceed to T22.

[0127] T22-T23: Report Aggregation and Output

[0128] The aggregation output module sorts nodes in ascending order of depth and concatenates the content of all nodes (from leaf to root).

[0129] Generate table of contents structure, headers and footers, and chart references;

[0130] Output the final report (Word / PDF format) and deliver it to the user.

[0131] It should be understood that: Key technology assurance:

[0132] Deterministic guarantee: Temperature=0 and seed is fixed throughout the process to ensure that the MD5 hash of the same triplet configuration is consistent across multiple runs;

[0133] Consistency Guarantee: Version dependency locks ensure the ironclad causal law that "no content means no digest, and no child digest means no parent content";

[0134] Efficiency Guarantee: The parent node only depends on the child digest, which greatly reduces token consumption and significantly improves generation speed.

[0135] Among them, a large language model segment-by-segment accurate report generation system is proposed. The system includes a template parsing engine, a data governance engine, a triple binding engine, a recursive generation scheduler, a version dependency lock manager, an LLM interface encapsulation module, a version chain manager, and a causal chain verifier.

[0136] It should be noted that the specific steps for system operation are as follows:

[0137] Template parsing engine:

[0138] Step S1: Template parsing and node tree construction

[0139] Users upload report sample templates (DOCX format) through the application layer's "Template Management Module";

[0140] The template parsing engine calls the layout analysis model (LayoutLM or self-developed rule engine) to identify the document's heading levels, paragraph boundaries, and indentation relationships;

[0141] Output a tree-structured collection of paragraph nodes, where each node contains: node_id (unique identifier), parent_id (parent node reference), depth (level depth), and node_type (leaf / parent node identifier).

[0142] The node tree structure is persisted to the triplet storage unit, awaiting data slot binding.

[0143] Data Governance Engine: Step S2: Data Governance and Slot Population

[0144] Users configure data governance rules (SQL queries, API interfaces, or regular expressions) through the application layer.

[0145] The data governance engine connects to business data sources (MySQL / Oracle / REST API) and executes governance rules to extract structured data;

[0146] The extracted data is written to a data slot pool. Each data slot is in JSON format, and the field names correspond to the business semantics (e.g., {"industry":"new energy", "risk_value":0.37}).

[0147] Data slots and nodes are mapped one-to-one using node_id, supporting hot reloading updates (without requiring a service restart).

[0148] Triple Binding Engine: Step S3: Triple Binding and Persistence

[0149] The system binds a prompt template (prompt_template) to each node. The template includes system_prompt (role setting) and user_prompt (generation command, including variable placeholders such as {{industry}}).

[0150] This forms a triplet structure: (node_id, data_slot, prompt_template, causal_type), where causal_type marks the node as either "leaf_content" (leaf content generation) or "parent_aggregation" (parent node aggregation).

[0151] Triples are stored in the Triple Store and support version number management (initial version v0).

[0152] Recursive Scheduler Generation: Step S4: Recursive Scheduling and Version Dependency Lock Control

[0153] The scheduler uses a post-order traversal algorithm to ensure that leaf nodes are processed first, followed by parent nodes.

[0154] For each node to be generated, the version dependency lock manager checks its dependency status:

[0155] If it is a leaf node: check if the data_slot is already filled (status: ready / unready);

[0156] If it is the parent node: check whether the abstract_version of all child nodes has been generated and stored (by querying the Version Chain).

[0157] If the dependency is not satisfied, the node task enters the blocking queue and waits for the dependency ready event to be triggered; if the dependency is satisfied, the task enters the execution queue and is submitted to the LLM interface encapsulation module.

[0158] LLM Interface Encapsulation: Step S5: LLM Call and Causal Sequential Execution

[0159] For leaf nodes (causal_type=leaf_content):

[0160] First call: Inject data_slot into prompt_template, and call LLM to generate complete paragraph content (Paragraph).

[0161] Second call: Take the Paragraph as input and call LLM to extract the abstract.

[0162] The two calls are forced to proceed in a synchronous blocking mechanism, meaning the second call must wait for the first call to return a result.

[0163] Set temperature=0 and seed=42 to ensure deterministic output;

[0164] For the parent node (causal_type=parent_aggregation):

[0165] Query the latest abstract_version of all child nodes from the Version Chain;

[0166] Concatenate the sub-abstracts into a context (Context = Σ child.abstract) and inject it into the parent node prompt_template;

[0167] Call LLM to generate the parent paragraph content, and then call it again to extract the parent summary;

[0168] The parent node's prompt never contains the complete content (full text) of the child nodes; it only uses a summary to achieve token compression.

[0169] Step S6: Version chain storage and dependency record (version chain manager)

[0170] Each generated result (content / abstract) is written to the Version Chain and recorded:

[0171] version_id (version number, such as v1, v2...)

[0172] content_hash (MD5 checksum)

[0173] dependencies (an array of dependencies, such as [{"node_id":"child_1", "abstract_version":"v3"}])

[0174] timestamp (generate timestamp)

[0175] If a child node version is updated (e.g., child_1 changes from v3 to v4), the Version Chain automatically triggers a dependency update event, marking the parent node's state as "stale" (pending update).

[0176] Step S7: Causal chain integrity verification and report output

[0177] After the recursive scheduler reaches the root node and completes generation, the causal chain verifier performs a full-link check:

[0178] Traverse all leaf nodes and confirm that their abstract_version has appeared in the dependencies chain of the root node;

[0179] Check for isolated nodes (leaves that are not involved in aggregation) or version breaks (the digest version that the parent node depends on has expired).

[0180] If the verification passes, the aggregation output module sorts by node depth, concatenates all paragraph content, and generates a PDF / Word report.

[0181] If verification fails, a CausalChainBrokenError is returned, blocking the report output and indicating the missing node.

[0182] It supports deployment on cloud servers and private servers, receives generation requests via API interface with a response time of less than 3 seconds, and supports hot reloading of configuration packages with zero restart.

[0183] It should be noted that the specific implementation steps are as follows:

[0184] 1) Users upload DOCX report templates, the system performs layout analysis, and constructs a node tree;

[0185] 2) Configure SQL / API data rules, and the data governance engine extracts data and populates it into data slots;

[0186] 3) Bind prompt word templates to each node to complete the persistent binding of triples;

[0187] 4) Start the recursive generation scheduler and execute it in post-order traversal:

[0188] Leaf node → Content generation → Summary extraction → Parent node aggregation → Layer by layer upwards → Root node;

[0189] 5) The version chain records content, summary, version, MD5, and dependencies in real time;

[0190] 6) The causal chain validator performs full-link verification;

[0191] 7) After verification, output a PDF / Word report by concatenating the layers.

[0192] Implementation results: Data misalignment rate: basically 0

[0193] Abstract-content match rate: >99%

[0194] Token consumption reduced: 60%–80%

[0195] Result: Multiple MD5 hashes are completely consistent.

[0196] Partial update time: seconds

[0197] Supports hot updates, version tracking, and audit compliance.

[0198] Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

Claims

1. A method for generating accurate segment-by-segment reports from a large language model, characterized in that: The method includes the following steps: a. Parse the report template into a tree-like collection of paragraph nodes, and persistently bind a unique data slot and prompt word template to each node to form a hot-loadable triplet configuration package; b. For leaf nodes, first call the large language model to generate paragraph content and store the first version, then extract the summary sentence from the content and store the second version. The order of the two calls is forcibly guaranteed by the version lock mechanism. c. For the parent node, collect the summary sentence versions of all child nodes and verify the integrity of dependencies. Only aggregate the child summaries and inject them into the parent node prompt word template to generate the parent content. The parent node prompt words do not contain the full text of the child nodes. d. Recursively execute step c until the root node, and finally check the integrity of the causal chain during aggregation, blocking the output of missing dependencies.

2. The method and system for generating accurate segment-by-segment reports for a large language model according to claim 1, characterized in that: The data slots in the triplet configuration package are JSON structures, and the field names and prompt word template variables are dynamically bound using double curly braces {{}}, supporting hot reloading and updates.

3. The method and system for generating accurate segment-by-segment reports for a large language model according to claim 1, characterized in that: Leaf node generation involves two large language model calls. The input to the second summary extraction call must include the output of the first content generation call, and the order is enforced by a version lock mechanism.

4. The method and system for generating accurate segment-by-segment reports for a large language model according to claim 1, characterized in that: The number of input tokens for the parent node = the sum of the number of digest tokens for all child nodes + the number of data slot tokens for the parent node, thus minimizing token redundancy.

5. The method and system for generating accurate segment-by-segment reports for a large language model according to claim 1, characterized in that: The version dependency lock mechanism listens for child node summary version change events, automatically marks the parent node as pending update, and records the chain dependency relationship.

6. The method and system for generating accurate segment-by-segment reports for a large language model according to claim 1, characterized in that: The causal chain integrity check function traverses all leaf nodes and checks whether their summary versions have been aggregated to the root node level by level. If they are missing, the report output is blocked.

7. A system for generating accurate segment-by-segment reports for a large language model, wherein the system applies the method for generating accurate segment-by-segment reports for a large language model as described in any one of claims 1 to 6, characterized in that: The system includes a template parsing engine, a data governance engine, a triple binding engine, a recursive generation scheduler, a version dependency lock manager, an LLM interface encapsulation module, a version chain manager, and a causal chain verifier.

8. The system for generating accurate segment-by-segment reports for a large language model according to claim 7, characterized in that: It supports deployment on cloud servers and private servers, receives generation requests via API interface with a response time of less than 3 seconds, and supports hot reloading of configuration packages with zero restart.