Engineering document generation method and system based on logic structure tree and LLM and medium

By using a logical structure tree and LLM-based approach, the problems of structural chaos and content imbalance in engineering document generation were solved, resulting in well-structured and complete engineering documents, thus improving the reliability and accuracy of the generated results.

CN121189289APending Publication Date: 2025-12-23SCHOOL OF SOFTWARE ZHEJIANG UNIV (NINGBO) MANAGEMENT CENT (NINGBO SOFTWARE EDUCATION CENT)
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511286574.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-10
Publication Date
2025-12-23

AI Technical Summary

Technical Problem

Existing technologies suffer from weak coherence between chapters, ambiguous hierarchy, inconsistent formatting, and a lack of balance in technical details when generating engineering documents. They are also prone to creating the 'illusion' of repetitive descriptions and logical inconsistencies, making it difficult to meet the accuracy and reproducibility requirements of engineering applications.

Method used

By employing a logical structure tree and LLM-based approach, the logical structure tree is constructed, recursively expanded, and optimized through document parsing and logical structure tree initialization. Combined with retrieval enhancement mechanisms and length control, this generates engineering documents with a rigorous structure and complete content.

Benefits of technology

It achieves a clear, logically rigorous, and technically detailed engineering document structure, reduces repetitive descriptions and errors, and improves the reliability and accuracy of the generated results, making it suitable for multiple rounds of modification and version iteration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121189289A_ABST
    Figure CN121189289A_ABST
Patent Text Reader

Abstract

The invention discloses an engineering document generation method and system based on a logic structure tree and LLM and a medium. The method comprises the steps that original data are analyzed to form an initial text segment set X; calling LLM to generate an initial technical draft based on X, extracting a logic structure, and constructing an initial logic structure tree T; maintaining a search queue, for leaf nodes in the queue, acquiring context information related to semantics from X through a retrieval enhancement mechanism, after same-level brother node deduplication and global deduplication judgment, calling LLM to expand the nodes to generate child nodes, optimizing text description, and recursively enriching a tree structure; and finally, based on the X and the optimized tree, calling LLM to generate a title, an abstract and a background, generating content, details and key point chapters through traversal, and combining into a complete engineering document. The system comprises a document analysis module, a knowledge base module, a retrieval enhancement module, a logic structure tree maintenance module and a document generation module. The method is high in automation degree, and the generated document is clear in structure, complete in content and high in specialty.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing and artificial intelligence technology, and relates to a technology for intelligent content generation using LLM (Large Language Model), and in particular to a method, system and medium for generating engineering documents based on a logical structure tree and LLM. Background Technology

[0002] Large Language Models (LLMs), such as GPT-4, LLaMA, and DeepSeek, have become important tools for generating various engineering document drafts due to their powerful natural language understanding and generation capabilities. Existing engineering document generation methods based on large language models can be divided into two main technical approaches according to their input processing methods: The first type of method is based on document structure parsing and extraction. This type of method first preprocesses the original materials provided by the user (such as project reports or design specifications in PDF or Word format), using text extraction tools (such as PyMuPDF) to identify and extract the main text content, as well as structured information including titles, abstracts, and chapters. Then, the extracted main text content, structured information, and user-specified natural language prompts (such as "generate project background chapter") are combined into an input sequence and submitted to a large language model deployed locally or in the cloud to generate a preliminary draft of the project document. The effectiveness of this type of method highly depends on the quality of the front-end's structured parsing of the original materials; its technical approach can be seen in the document interpretation and summarization functions of intelligent document tools such as Scispace and Notion AI.

[0003] The second type of method directly uses the full text of the original material as contextual input, without requiring explicit structural analysis steps. Users upload the complete original material as an attachment, supplemented with natural language prompts (such as "Write a complete process description based on the uploaded document"). The system inputs the natural language prompts and the original material file together into the large language model, directly outputting coherent natural paragraphs as a preliminary draft of the engineering document. This type of method heavily relies on the large language model's own support for multimodal input, and this technical approach has become the standard way for mainstream conversational AI platforms such as ChatGPT and Claude to process documents.

[0004] However, despite the progress made by the aforementioned methods in the automatic generation of engineering documents, they still have several significant limitations. First, engineering documents typically require a rigorous structure, a complete logical chain, and a standardized terminology system. Current large language models often generate preliminary engineering document drafts that suffer from weak inter-chapter coherence, inconsistent formatting, and ambiguous hierarchical structures, making it difficult to meet the accuracy and reproducibility requirements of practical engineering applications. Second, the generated preliminary engineering document drafts lack balance in the presentation of technical details: key algorithms or design steps are often oversimplified, lacking necessary supporting details; while non-core content may be redundantly expanded, resulting in a loose overall content structure and an imbalance in focus. Furthermore, large language models are prone to repetitive narration, logical inconsistencies, and even factual errors ("illusions") when processing long texts and multi-module inputs, severely restricting the reliability and practicality of the generated preliminary engineering document drafts.

[0005] To alleviate the aforementioned problems, existing improvement strategies mainly focus on prompt engineering and retrieval-augmented generation (RAG). For example, OpenAI proposed in its GPT-4 Technical Report (OpenAI. GPT-4 Technical Report. 2023.) to guide models to follow pre-defined logic through systematic prompt design; Yao et al. (Yao, S. et al. Prompt Programming for Large Language Models. arXiv:2202.07303.) studied the introduction of examples into prompts to enhance the model's complex reasoning ability; RAG technology improves the accuracy of generated content by retrieving relevant context from external knowledge bases. Although these methods have improved the generation quality to some extent, they still fail to systematically solve the fundamental problems in engineering document generation, such as structural deficiencies, uncontrolled granularity, and content imbalance. Therefore, a new technical solution is urgently needed that can achieve precise control over document structure and detail levels, thereby generating engineering documents that are both structurally rigorous and content-complete. Summary of the Invention

[0006] The purpose of this invention is to overcome the aforementioned deficiencies of the prior art and provide a method, system, and medium for generating engineering documents based on a logical structure tree and LLM. This invention aims to solve the structural problems of weak inter-chapter coherence, ambiguous hierarchy, and inconsistent formatting in documents generated by existing technologies, as well as the problems of unbalanced technical details, oversimplification of key steps, and redundant expansion of core content, resulting in uncontrolled granularity. Furthermore, it can alleviate the problems of repetitive narration, logical inconsistencies, and factual errors ("illusions") that easily occur when large language models generate long, multi-module documents, improving the reliability and accuracy of the generated results. This enables structured control and precise management of the engineering document generation process, generating high-quality engineering documents that combine structural rigor and content completeness.

[0007] The technical solution adopted by this invention to solve the above-mentioned technical problems is: a method for generating engineering documents based on a logical structure tree and LLM, characterized by including the following steps: S1. Document Parsing and Logical Structure Tree Initialization: The original material is parsed, divided into several text segments, and the text content of each segment is extracted to form an initial set of text segments X = {x1, x2, ..., x...} L The set X collectively encompasses all text content of the original material, including titles, abstracts, chapter names, main text, and formulas. L represents the total number of text segments, where a text segment refers to a content unit with relatively complete semantics obtained after parsing, corresponding to a natural paragraph or page in the original material. A logical structure tree for organizing and driving the engineering document generation process is initialized. This tree initially contains only a root node r representing the engineering document to be generated, and r's text description r.text and child node set r.child are both empty. S2. Logical Structure Tree Construction: Based on X and natural language prompts, the large language model is invoked to generate an initial draft of the technical content. draft Then from d draft Extract the logical structure and transform it into a tree structure to generate an initial logical structure tree T = (V, E, r). The logical structure contains several logical sub-units and the logical relationships between these logical sub-units. Each logical sub-unit covers a textual description of a concept definition, algorithm steps, or design details. V represents the set of nodes in T, and each non-root node corresponds to a logical sub-unit. E represents the set of directed edges between nodes in T, representing the logical relationships between nodes. S3. Recursive Expansion and Optimization of the Logical Structure Tree: Maintain a search queue storing all leaf nodes of the current logical structure tree, where the current logical structure tree is initially the initial logical structure tree T. For each leaf node in the search queue, first, through a retrieval enhancement mechanism, retrieve and obtain preliminary context information highly semantically related to its text description from the knowledge base built based on X. Then, filter the preliminary context information, removing context information already covered by its sibling nodes, and determine whether there is still retained context information after filtering. If not, terminate the process; if so, record the retained context information as d. ctx Next, determine d. ctx Whether it is covered by any other node in the current logical structure tree except for the set of child nodes of its parent node. If not covered, then based on d ctx The large language model is invoked to perform an expansion operation on the leaf node to generate its set of child nodes, and an optimization operation to optimize its text description. The newly generated leaf node is then added to the search queue. At the same time, the process is continuously monitored. If the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset total length threshold or the search queue is empty, the expansion and optimization process is terminated. S4. Preliminary Engineering Document Draft Generation: Based on the initial text segmentation set X and the expanded and optimized logical structure tree T. best It generates titles, abstracts, and project backgrounds by calling a large language model, and iterates through T... best Generate chapters on project content, project details, and key project points, and finally combine them into a preliminary project document draft Y.

[0008] The specific process of step S3 is as follows: S3.1. Initialize a search queue Q; then use T as the current logical structure tree, and add all leaf nodes of the current logical structure tree as candidate nodes for expansion and optimization to Q; S3.2 Determine if Q is empty. If it is empty, proceed to step S4; otherwise, remove the candidate node v at the head of the queue from Q. t And record v t Parent node v f ; S3.3, Retrieve and obtain information related to v from the knowledge base built on X. t Text description v t First, obtain preliminary context information that is highly semantically relevant to the .text tag. Then, filter this preliminary context information to remove context information already covered by sibling nodes. Next, determine if any context information remains after filtering; if so, denote the remaining context information as d. ctx If so, proceed to step S3.4; otherwise, consider v to be...t No further expansion or optimization is needed; return to step S3.2 to continue execution. S3.4 Perform global deduplication, that is, determine the number of elements in the current logical structure tree except for v. f The set of child nodes v f Are there any nodes outside of .child that already contain d? ctx If so, then v is considered... t No expansion or optimization is needed, and the process returns to step S3.2 to continue; otherwise, proceed to step S3.5. S3.5, Call the large language model, based on d ctx , for v t Execute the expand operation Expand(v) t To generate its set of child nodes v t .child, and perform the optimization operation Refine(v t To optimize its text description v t .text; then v t The newly generated leaf nodes in .child are added to Q as candidate nodes for expansion and optimization; then step S3.6 is executed. S3.6. Evaluate the overall state of the current logical structure tree. If the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset overall length threshold, then execute step S4; otherwise, return to step S3.2 to continue execution.

[0009] Steps S3.1 to S3.6 provide a detailed and operable process for step S3 (recursive expansion and optimization of the logical tree structure), clarifying the use of a FIFO search queue for breadth-first traversal, and defining in detail each step from search queue processing to termination judgment. The search queue and breadth-first order ensure that the tree structure expansion process is systematic, predictable, and complete, avoiding local over-expansion that might occur with depth-first search, and optimizing the allocation of computational resources. Clear loop termination conditions (empty queue or reaching a length threshold) effectively prevent infinite loops or excessive consumption of computational resources, making the entire generation process more robust and controllable.

[0010] In step S3.3, the process of constructing a knowledge base based on X is as follows: Each text segment in X is mapped to an embedding vector using a vectorization tool; then, a vector search tool is used to store all embedding vectors and build an index, forming a knowledge base that supports highly semantically relevant retrieval. Here, the specific technical means for constructing a knowledge base based on X are defined. By mapping text segments to embedding vectors and building an index, highly semantically relevant contextual information for the current node can be retrieved quickly and accurately from massive amounts of raw material, far exceeding traditional keyword-based retrieval methods, thus providing a high-quality information source for subsequent generation.

[0011] In step S3.3, the initial determination of context information is as follows: through relevance(a, v t (text) Calculate the relationship between each embedding vector a and v in the knowledge base. t The semantic relevance between .text tags, where relevance() calculates the relevance between a and v. t The semantic relevance between .text elements is calculated as a function; then, the text segments corresponding to the embedding vectors with semantic relevance higher than a preset relevance threshold are used as preliminary context information. Here, by using a preset relevance threshold, semantically weak noise information is filtered out, ensuring that the context information input to the large language model is highly relevant, thereby directly improving the accuracy and focus of the subsequently generated content.

[0012] In step S3.3, the process of removing context information already covered by sibling nodes at the same level is as follows: S3.3a. Construct a candidate set S from the preliminary context information; S3.3b. For any text segment b in S, calculate its filtering score F(b), F(b) = relevance(b, v t .text)-max(relevance(b,v e .text), v e Belongs to v f .child\{v t}), where v e .text represents v t sibling node v e The text description, v f .child is v f The set of child nodes, where \ indicates exclusion; S3.3c. If F(b) is less than the preset filtering threshold, then remove b from the candidate set S. S3.3d, After processing, the remaining text segments in S are the retained context information d. ctx .

[0013] Steps S3.3a to S3.3d provide a quantitative, rating-based comparison method F(b) = relevance(b, v t .text)-max(relevance(b,v e The `.text` property is used to precisely remove contextual information already covered by sibling nodes. This process intelligently determines whether a piece of information has been fully expressed by sibling nodes. Only information that is significantly more relevant to the current node than to any sibling node will be retained. This greatly improves the accuracy of deduplication, effectively avoids content duplication between sibling nodes, and ensures the simplicity of the tree structure and the uniqueness of the content.

[0014] In step S3.5, Expand(v t The specific process is as follows: S3.5a, Call the large language model, using d ctx and extended natural language prompt words σ expand As input, generate v t Supplementary paragraphs to the .text file; S3.5b: Perform semantic segmentation and summarization on the supplementary paragraphs to extract several sub-key points; S3.5c, Create a child node for each sub-point and use the text generated for each sub-point as the text description of the corresponding child node; S3.5d, Add all created child nodes to v in sequence. t In .child.

[0015] Steps S3.5a to S3.5d define the specific steps of the expansion operation, including generating supplementary paragraphs, semantically segmenting and summarizing sub-points, and creating child nodes. This process does not allow the LLM to generate text arbitrarily, but rather guides it to first generate coherent paragraphs, then automatically decompose them into logical sub-points, and finally transform them into structured child nodes. This ensures that the newly generated subtree itself has good internal logic and structure, and is not merely a piling up of text.

[0016] In step S3.5, Refine(v t The specific process is as follows: S3.5e, Recognizing v t Key nouns in the .text that are not fully explained; S3.5f Determine whether the key term is a unique term in the original material. If so, first retrieve the text segment corresponding to the embedding vector related to the key term from the knowledge base through the retrieval enhancement mechanism, and then call the large language model and complete the description of the key term based on the retrieved text segment; otherwise, directly call the large language model to supplement the content of the key term. S3.5g, Update v t .text.

[0017] Steps S3.5e to S3.5g define the specific steps of the optimization operation, including identifying key terms, determining whether they are proprietary terms, and optimizing the description using either search enhancement or direct supplementation methods. This process intelligently identifies knowledge gaps in the text (key terms that are not fully explained). For proprietary terms in the engineering field, it prioritizes finding authoritative explanations from the original materials to maximize the accuracy of the description and its consistency with the source materials. For general terms, it supplements them using LLM common sense, which significantly improves the professionalism and readability of the document.

[0018] In step S4, the preliminary engineering document draft Y includes a title, an abstract, and sections on engineering background, engineering content, engineering details, and engineering key points. The process of generating the title, abstract, and engineering background section is as follows: using X and relevant natural language prompts as input, a large language model is invoked to directly generate the title, abstract, and engineering background. The process of generating the project content chapters is as follows: (Based on T) best Starting from the root node, a breadth-first traversal is performed. Semantic judgment is performed using a large language model. Combined with the depth threshold of the logical structure tree and the overall length limit preset for Y, the logical subtree T that constitutes the core content of the project is dynamically determined. content Then for T content Perform a depth-first traversal, following the sequence "number + v". content Expand the text into a ".text" format and combine them to form the initial draft of the project content. content .text represents T content The text description of the nodes in the document is then used; a large language model is then called to generate a beneficial effect paragraph at the end of the initial draft of the project content, and to supplement the description of the project's advantages and value; finally, the large language model is called to polish the style, standardize the terminology, and optimize the structure to obtain the final project content. The process of generating engineering details is as follows: using T best Starting from the root node, a depth-first traversal is performed, expanding the data according to the format "number + v.text" to form an initial draft of engineering details covering all algorithm steps and design details, where v.text represents T. bestThe text description of the nodes in the process is then used; then, a large language model is called to polish the style, standardize the terminology, and optimize the structure of the initial draft of the engineering details, so as to obtain the final engineering details. The process of generating key project points is as follows: using T best Starting from the root node, a breadth-first traversal is performed. A large language model is used for semantic determination. Combined with the depth threshold of the logical structure tree and the overall length limit preset for Y, the logical subtree T that constitutes the key points of the project is dynamically determined. claim0 Then iterate through T. claim0 The leaf nodes, for each leaf node, in T best In the middle, locate the corresponding subtree with the root node, call the large language model, combine the text descriptions of all nodes in the subtree, and optimize the text description of the leaf node; then in T claim0 After optimizing the text descriptions of all leaf nodes, the optimized logical subtree T is obtained. claim1 Then for T claim1 Perform a depth-first traversal, following the sequence "number + v". claim1 Expand the text into a .text format and combine them to form a draft of the project key points. claim1 .text represents T claim1 The text descriptions of the nodes are then used; finally, a large language model is called to polish the style, standardize the terminology, and optimize the structure of the initial draft of the project key points, resulting in the final project key points. The generated title, abstract, project background, project content, project details, and project key points are combined according to the set project document chapter structure to obtain the preliminary project document draft Y.

[0019] This section details the specific strategies for generating each chapter in step S4, particularly the different traversal methods (BFS / DFS) and dynamic decision-making strategies used for different chapters (project content, project details, and project key points). Project content generation utilizes BFS combined with dynamic decision-making to intelligently extract core and main content, avoiding redundancy. Project detail generation uses DFS to traverse all nodes, ensuring comprehensive coverage of all technical details. Project key point generation optimizes leaf nodes (elevating them to represent the entire subtree as summaries) and then expands them, generating concise yet precise key points. The independent generation of "beneficial effects" paragraphs and the unified "style polishing and terminology standardization" steps significantly enhance the commercial value, professionalism, and presentation quality of the final output document, bringing it close to or even surpassing the level of human writing.

[0020] A system for generating engineering documents based on a logical structure tree and LLM for implementing the above method, characterized in that it includes: The document parsing module is used to parse the original material, divide it into several text segments, and extract the text content of each text segment to form an initial text segment set X. Here, the text segment refers to a content unit with relatively complete semantics obtained after parsing, which corresponds to a natural paragraph or a page in the original material. The document knowledge base module is used to map each text segment in the initial text segment set X into an embedding vector, and then store all embedding vectors and build an index to form a knowledge base that supports highly semantically relevant retrieval. The retrieval enhancement module is used to retrieve and obtain contextual information that is highly semantically related to the textual description of a given node from the knowledge base; The logical structure tree maintenance module is used to perform the following operations: (a) Based on the initial text segment set X, and by calling the large language model, an initial logical structure tree T is generated; (b) Maintain a search queue containing all unprocessed leaf nodes in the current logical structure tree; (c) For each leaf node in the search queue, the retrieval enhancement module is invoked to obtain preliminary context information that is highly semantically related to its text description; then, the preliminary context information is filtered to remove context information already covered by its sibling nodes; then, it is determined whether there is still retained context information after filtering. If so, the retained context information is recorded as d. ctx Next, a global deduplication check is performed, that is, the check d is performed. ctx Whether it is covered by any other node in the current logical structure tree except for the set of child nodes of its parent node. If not covered, then based on d ctx The large language model is invoked to perform an expansion operation on the leaf node to generate its set of child nodes, and an optimization operation is performed to optimize its text description. The newly generated leaf node is then added to the search queue. (d) Monitor the current logical structure tree and the search queue. When the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset total length threshold or the search queue is empty, terminate the expansion and optimization process. The document generation module is used to generate a document based on the initial text segment set X and the logical structure tree T obtained after expansion and optimization by the logical structure tree maintenance module. best It generates titles, abstracts, and project backgrounds by calling a large language model, and iterates through T... best Generate chapters on project content, project details, and key project points, and finally combine them into a preliminary project document draft Y.

[0021] This invention clarifies that it can be implemented not only as a method but also as a specific system, providing a wider scope and greater practical value, and offering a clear architectural blueprint for software development, system integration, and commercial deployment.

[0022] A computer-readable storage medium having a computer program stored thereon, characterized in that the computer program implements the above-described method when executed by a processor.

[0023] This solution protects the physical carrier of the program code that carries the above method, enabling the invention to be commercialized through software sales, licensing, and other means. It also facilitates installation and use by users on different computing devices, greatly enhancing the market application potential and commercial value of the invention.

[0024] Compared with the prior art, the advantages of the present invention are as follows: This invention effectively overcomes the problems of structural chaos, incomplete content, and uncontrollable generation in existing technologies by introducing a logical structure tree as the core control mechanism and combining it with retrieval enhancement mechanisms, recursive expansion, and optimization. Specifically: 1. Clear and Logically Rigorous Document Structure: This invention constructs a logical structure tree and expands the generated content according to the node hierarchy, fundamentally ensuring that the generated engineering documents have good chapter structure and coherence. This effectively improves the structural clarity and logical rigor of the generated engineering documents, solving the structural chaos problem existing in existing technologies. The system can dynamically adjust the generation scope according to needs, significantly improving content coverage, and the final output is rich and well-organized.

[0025] 2. Complete technical details: By using retrieval enhancement mechanisms to inject relevant original material context into each tree node, the large language model is guided to generate detailed and reproducible technical details.

[0026] 3. Controllable and flexible generation process: Based on the node-level expansion strategy of the logical structure tree, this invention supports independent rewriting, refinement or supplementation of specified technical points, avoiding repetitive work and uncontrollable risks brought about by overall generation, improving editing efficiency and flexibility, and is suitable for multi-round modification and version iteration scenarios.

[0027] 4. Effectively suppress "illusions," reduce redundancy, and improve content accuracy: Constrain the generation scope of the large language model to the reliable contextual information retrieved and deduplicated from the original material (d ctx Within this scope, the probability of generating factual errors and irrelevant redundant content is significantly reduced, improving the reliability and usability of the generated engineering documents.

[0028] 5. Achieving Content Hierarchy Expansion and Structural Balance: This invention dynamically determines whether nodes need to be expanded, retained, or pruned by traversing the logical tree structure and combining it with a heuristic judgment mechanism. This achieves a balanced distribution of content among chapters such as "Project Content" and "Project Details," solving the problems of insufficient focus and unbalanced content in traditional methods. Simultaneously, through recursive expansion and global length monitoring, it automatically balances the depth and breadth of content, avoiding the loss of key points or the proliferation of irrelevant content.

[0029] 6. High consistency of generated results: Unified post-processing (polishing, standardization) ensures a high degree of consistency and standardization in terminology and style, enhancing the professionalism of the documents.

[0030] In summary, this invention has achieved significant improvements in terms of generation accuracy, process controllability, content coverage, and structural standardization, and has high practical value. It is particularly suitable for engineering document writing, and can effectively improve the efficiency and quality of engineering document writing while reducing labor costs. Attached Figure Description

[0031] Figure 1 This is a flowchart illustrating the overall implementation of the method of the present invention; Figure 2 This is a block diagram of the overall composition of the system of the present invention. Detailed Implementation

[0032] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0033] Implementation Case 1: This invention proposes an engineering document generation method based on a logical structure tree and LLM (Logical Language Model). The method comprises four steps, mapping given raw materials to a preliminary engineering document draft. The entire process uses the logical structure tree as its core, combined with the natural language generation capabilities provided by a large language model, to complete a closed-loop generation strategy from node construction and optimization to recursive expansion. The overall implementation flowchart is shown below. Figure 1 As shown, it includes the following steps: S1. Document Parsing and Logical Structure Tree Initialization: The document parsing module receives the original material D (such as PDF or Word format) uploaded by the user, uses the PyMuPDF text extraction tool to parse the original material, divides it into several text segments, and extracts the text content of each text segment to form an initial text segment set X = {x1, x2, ..., x...} L The set X collectively encompasses all text content of the original material, including titles, abstracts, chapter names, main text, and formulas, where L represents the total number of text segments, and x... iRepresents the i-th text segment, i=1,2,…,L. A text segment refers to a content unit with relatively complete semantics obtained after parsing, which corresponds to a natural paragraph or a page in the original material. Initialize a logical structure tree for organizing and driving the engineering document generation process. The tree initially contains only a root node r to represent the engineering document to be generated, and the text description r.text and the set of child nodes r.child of r are both empty.

[0034] S2. Logical Structure Tree Construction: The logical structure tree maintenance module, based on X and natural language prompt words σ1, calls the large language model to generate an initial technical content draft d. draft d draft ←M(σ1,X), where the function M is an abstract representation of the large language model; then from d draft Extract the logical structure and transform it into a tree structure to generate an initial logical tree structure (ordered tree) T = (V, E, r). The logical structure contains several logical sub-units (such as chapters, paragraphs, key sentences, etc.) and the logical relationships between these logical sub-units. Each logical sub-unit covers a textual description of a concept definition, algorithm steps, or design details. V represents the set of nodes in T, r belongs to V, each non-root node (i.e., each node except r) corresponds to a logical sub-unit, E represents the set of directed edges between nodes in T, representing the logical relationships between nodes, satisfying the structural properties of a tree, and each non-root node has one and only one parent node.

[0035] Here, from the initial draft of the technical content d draft Extracting the logical structure using existing technologies, employing natural language processing techniques (such as regular expressions, keyword recognition, etc.) from d draft The system identifies chapters, paragraphs, key sentences, etc., and marks the identified chapters, paragraphs, key sentences, etc. as logical sub-units.

[0036] S3. Recursive Expansion and Optimization of the Logical Structure Tree: The logical structure tree maintenance module maintains a search queue storing all leaf nodes of the current logical structure tree, where the current logical structure tree is initially the initial logical structure tree T. For each leaf node in the search queue, preliminary context information highly semantically related to its text description is first retrieved from the knowledge base built based on X through a retrieval enhancement mechanism. Then, the preliminary context information is filtered to remove context information already covered by its sibling nodes, and it is determined whether there is still retained context information after filtering. If not, the processing is terminated; if so, the retained context information is denoted as d. ctx Next, determine d. ctx Whether it is covered by any other node in the current logical structure tree except for the set of child nodes of its parent node. If not covered, then based on dctx The large language model is invoked to perform an expansion operation on the leaf node to generate its set of child nodes, and an optimization operation to optimize its text description. The newly generated leaf node is then added to the search queue. At the same time, the process is continuously monitored. If the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset overall length threshold or the search queue is empty, the expansion and optimization process is terminated to avoid excessive content expansion.

[0037] In practice, step S3 involves the following steps: S3.1. Initialize a search queue Q, which is a first-in-first-out (FIFO) queue to ensure that the expansion of the logical structure tree follows a breadth-first order; then, take T as the current logical structure tree and add all leaf nodes (i.e. nodes that currently have no child nodes) in the current logical structure tree as candidate nodes for expansion and optimization to Q.

[0038] S3.2. Determine if Q is empty. If it is empty, it means all leaf nodes have been processed, then proceed to step S4; otherwise, remove the candidate node v at the head of the queue from Q. t And record v t Parent node v f .

[0039] S3.3, Invoke the retrieval enhancement module to retrieve and obtain data related to v from the knowledge base built on X. t Text description v t The `.text` element first obtains semantically relevant preliminary context information; then, it filters this preliminary context information, removing elements already associated with sibling nodes (v...). f .child\{v t}, that is, with v t Other nodes with the same parent node, v f .child is v f The set of child nodes (\ indicates exclusion) covers the context information; then determine whether there is still context information to retain after filtering. If so, denote the retained context information as d. ctx If so, proceed to step S3.4; otherwise, consider v to be... t No further expansion or optimization is required, and the process returns to step S3.2 to continue execution.

[0040] In specific implementation, in step S3.3, the process of building a knowledge base based on X is as follows: the document knowledge base module uses a vectorization tool to map each text segment in X into an embedding vector; then, a vector search tool is used to store all the embedding vectors and build an index to form a knowledge base that supports highly semantically relevant retrieval.

[0041] Here, vectorization tools such as Sentence-BERT (from Reimers, N. & Gurevych, I. Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks. EMNLP 2019.) and vector search tools such as FAISS (from Johnson, J. etal. Billion-scale similarity search with FAISS. arXiv:1702.08734.) or Hakes (from Hu, Guoyu, et al. "HAKES: Scalable VectorDatabase for Embedding Search Service." arXiv preprint arXiv:2505.12524(2025).) are used.

[0042] In specific implementation, the initial determination process of context information in step S3.3 is as follows: through relevance(a,v) t (text) Calculate the relationship between each embedding vector a and v in the knowledge base. t The semantic relevance between .text tags, where relevance() calculates the relevance between a and v. t A function for semantic relevance between .text elements, such as the cosine similarity function, is used; then, the text segments corresponding to the embedding vectors with semantic relevance higher than a preset relevance threshold are used as preliminary context information.

[0043] In specific implementation, step S3.3, the process of removing context information already covered by sibling nodes at the same level, is as follows: S3.3a. Construct a candidate set S from the preliminary context information.

[0044] S3.3b. For any text segment b in S, calculate its filtering score F(b), F(b) = relevance(b, v t .text)-max(relevance(b,v e .text), v e Belongs to v f .child\{v t}), where max() is the function to find the maximum value, v e .text represents v t sibling node ve The text description, v f .child is v f The set of child nodes, where \ indicates exclusion.

[0045] S3.3c. If F(b) is less than the preset filtering threshold, then remove b from the candidate set S.

[0046] S3.3d, After processing, the remaining text segments in S are the retained context information d. ctx .

[0047] S3.4 Perform global deduplication, that is, determine the number of elements in the current logical structure tree except for v. f The set of child nodes v f Are there any nodes outside of .child that already contain d? ctx If so, then v is considered... t No expansion or optimization is needed, and the process returns to step S3.2 to continue execution; otherwise, proceed to step S3.5.

[0048] Here, when performing global deduplication, the same process as steps S3.3a to S3.3d above can be used to remove context information that is already covered by nodes in other branches of the current logical structure tree.

[0049] S3.5, Call the large language model, based on d ctx , for v t Execute the expand operation Expand(v) t To generate its set of child nodes v t .child, and perform the optimization operation Refine(v t To optimize its text description v t .text, the extension is for v t The covered technical points are further elaborated upon, supplementing the text descriptions of child nodes with conceptual definitions, algorithm steps, design details, etc., and optimization is achieved in v. t Based on existing text descriptions, a large language model is invoked to refine terminology, enhance formatting, or adjust logic; then, based on v... t .child, update the current logical structure tree, and set v t The newly generated leaf nodes in .child are added to Q as candidate nodes for expansion and optimization; then step S3.6 is executed.

[0050] Here, v t .text contains concept definitions, algorithm steps, design details, etc.; v t .child is used to supplement and refine v t The content corresponding to .text, the text description of the child nodes is used to describe v. tThe specific sub-steps in the algorithm steps contained in .text, or for v t The technical points involved in the .text section are described in further detail to form the technical points or implementation steps corresponding to this child node.

[0051] In specific implementation, in step S3.5, Expand(v t The specific process is as follows: S3.5a, Call the large language model, using d ctx and extended natural language prompt words σ expand As input, generate v t Supplementary paragraphs to the .text file.

[0052] S3.5b: Perform semantic segmentation and summarization on the supplementary paragraphs to extract several sub-points.

[0053] S3.5c: Create a child node for each sub-point and use the text generated for each sub-point as the text description of the corresponding child node.

[0054] S3.5d, Add all created child nodes to v in sequence. t In .child.

[0055] In specific implementation, in step S3.5, Refine(v t The specific process is as follows: S3.5e, Recognizing v t Key nouns in the .text that are not fully explained.

[0056] S3.5f: Determine whether the key term is a unique term in the original material. If so, first retrieve the text segment corresponding to the embedding vector related to the key term from the knowledge base through the retrieval enhancement mechanism, and then call the large language model to complete the description of the key term based on the retrieved text segment; otherwise, directly call the large language model to supplement the content of the key term.

[0057] S3.5g, Update v t .text.

[0058] S3.6. Evaluate the overall state of the current logical structure tree. If the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset overall length threshold, then execute step S4 to end early to avoid over-expansion optimization; otherwise, return to step S3.2 to continue execution.

[0059] This process is a top-down document expansion and generation process. Therefore, based on the expanded and optimized logical structure tree, after expansion, a project document can be formed by combining the text descriptions of all nodes.

[0060] S4. Preliminary Engineering Document Draft Generation: Based on the initial text segmentation set X and the expanded and optimized logical structure tree T. best It generates titles, abstracts, and project backgrounds by calling a large language model, and iterates through T... best Generate chapters on project content, project details, and key project points, and finally combine them into a preliminary project document draft Y.

[0061] In specific implementation, in step S4, the preliminary engineering document draft Y includes a title, abstract, and sections on engineering background, engineering content, engineering details, and engineering key points.

[0062] The process of generating the title, abstract, and engineering background section is as follows: taking X and relevant natural language prompts as input, calling a large language model, and directly generating the title, abstract, and engineering background that are closest to the original material and are clearly expressed.

[0063] The process of generating the project content chapters is as follows: (Based on T) best Starting from the root node, a breadth-first traversal is performed. Semantic judgment is performed using a large language model. Combined with the depth threshold of the logical structure tree and the overall length limit preset for Y, the logical subtree T that constitutes the core content of the project is dynamically determined. content Then for T content Perform a depth-first traversal, following the sequence "number + v". content Expand the text using the .text format to create a clear and well-organized initial draft of the project content. (v) content .text represents T content The process involves: first, generating a text description of each node; then, using a large language model to generate a beneficial effect paragraph at the end of the initial draft of the project content, and supplementing it with descriptions of the project's advantages and value; finally, using the large language model to refine the style, standardize terminology, and optimize the structure, resulting in the final project content.

[0064] The process of generating engineering details is as follows: using T best Starting from the root node, a depth-first traversal is performed, expanding the data according to the format "number + v.text" to form an initial draft of engineering details covering all algorithm steps and design details, where v.text represents T. best The text description of the nodes is then used; then, a large language model is called to polish the style, standardize the terminology, and optimize the structure of the initial draft of the engineering details, so as to obtain the final engineering details.

[0065] The process of generating key project points is as follows: using T best Starting from the root node, a breadth-first traversal is performed. A large language model is used for semantic determination. Combined with the depth threshold of the logical structure tree and the overall length limit preset for Y, the logical subtree T that constitutes the key points of the project is dynamically determined.claim0 Then iterate through T. claim0 The leaf nodes, for each leaf node, in T best In the middle, locate the corresponding subtree with the root node, call the large language model, combine the text descriptions of all nodes in the subtree, and optimize the text description of the leaf node; then in T claim0 After optimizing the text descriptions of all leaf nodes, the optimized logical subtree T is obtained. claim1 Then for T claim1 Perform a depth-first traversal, following the sequence "number + v". claim1 Expand the text into a .text format and combine them to form a draft of the project key points. claim1 .text represents T claim1 The text descriptions of the nodes are then used; finally, a large language model is called to polish the style, standardize the terminology, and optimize the structure of the initial draft of the project key points, resulting in the final project key points.

[0066] The generated title, abstract, project background, project content, project details, and project key points are combined according to the set project document chapter structure to obtain a preliminary project document draft Y (Word or PDF format), which is then available for manual proofreading or subsequent polishing by the user.

[0067] In this embodiment, the preset overall length threshold, preset relevance threshold, preset filtering threshold, and preset overall length restriction can all be determined to their optimal values ​​through extensive experiments on the method of the present invention. The setting of these thresholds or conditions does not affect the innovative points of the present invention.

[0068] Implementation Case 2: To implement the above-mentioned engineering document generation method based on logical structure trees and LLM, this invention provides an engineering document generation system based on logical structure trees and LLM for implementing the above method, such as... Figure 2 As shown, it includes: Document parsing module 1 is used to parse the original material, divide it into several text segments, and extract the text content of each text segment to form an initial text segment set X. Here, a text segment refers to a content unit with relatively complete semantics obtained after parsing, which corresponds to a natural paragraph or a page in the original material.

[0069] The document knowledge base module 2 is used to map each text segment in the initial text segment set X to an embedding vector, and then store all embedding vectors and build an index to form a knowledge base 6 that supports highly semantically relevant retrieval.

[0070] The retrieval enhancement module 3 is used to retrieve and obtain contextual information from the knowledge base 6 that is highly semantically relevant to the textual description of a given node.

[0071] Logical structure tree maintenance module 4 is used to perform the following operations: (a) Based on the initial text segment set X, and by calling the large language model, an initial logical structure tree T is generated.

[0072] (b) Maintain a search queue containing all unprocessed leaf nodes in the current logical structure tree.

[0073] (c) For each leaf node in the search queue, call the retrieval enhancement module 3 to obtain preliminary context information that is highly semantically related to its text description; then filter the preliminary context information to remove context information already covered by its sibling nodes; then determine whether there is still retained context information after filtering. If so, record the retained context information as d. ctx Next, a global deduplication check is performed, that is, the check d is performed. ctx Whether it is covered by any other node in the current logical structure tree except for the set of child nodes of its parent node. If not covered, then based on d ctx The large language model is invoked to perform an expansion operation on the leaf node to generate its set of child nodes, and an optimization operation to optimize its text description. The newly generated leaf node is then added to the search queue.

[0074] (d) Monitor the current logical structure tree and search queue. When the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset total length threshold or the search queue is empty, terminate the expansion and optimization process.

[0075] Document generation module 5 is used to generate a logical structure tree T based on an initial set of text segments X and an extended and optimized logical structure tree T obtained from the logical structure tree maintenance module. best It generates titles, abstracts, and project backgrounds by calling a large language model, and iterates through T... best Generate chapters on project content, project details, and key project points, and finally combine them into a preliminary project document draft Y.

[0076] The above modules interact with each other to form, as follows Figure 2 The system architecture shown supports an automated process from raw material input to preliminary engineering document draft output.

[0077] Implementation Case 3: This invention provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the method of Embodiment 1.

[0078] Note: In LLM (Large Language Model), the context is all the text input to the model, including instructions, natural language prompts, historical dialogues, knowledge fragments, etc. A large language model can be abstracted as a conditional generation function, M: (σ, d1) → d2, where σ represents the input natural language prompts, d1 represents the input context, and d2 represents a natural language segment of the output. This output undergoes further processing to form the generated content, which is then polished by humans.

[0079] The key technical points and areas to be protected in this invention include, but are not limited to, the following aspects: 1. Construct a logical structure tree and use it as a control unit to generate nodes one by one: This is the core mechanism for achieving structured and controllable content expansion, which is different from the traditional method of generating large language model documents.

[0080] 2. Perform controlled enhanced retrieval and context completion for each technical point: ensure that every technical step is supported by original text, improving the authenticity and completeness of the content. At the same time, filter out redundant information in the context and streamline the generated engineering documents.

[0081] 3. A pruning mechanism based on a logical structure tree maps nodes at different levels to different chapters of the project document: The logical structure tree is divided, and different subtrees are used for the generation of different chapters. For example, high-level nodes are used for "project content" and "project key points", while low-level nodes are used for "project details".

[0082] 4. Controllable generation strategy supporting local generation and incremental correction: solves the problem that existing solutions cannot be locally edited and expanded, and greatly improves document iteration efficiency.

[0083] The above key points are the core of what distinguishes this invention from the prior art and achieves its technical purpose, and are also the technical features that this invention focuses on for patent protection.

[0084] To achieve the technical objectives proposed in this invention, the invention adopts a technical approach of "logical structure tree + retrieval enhancement based on embedding vectors + hierarchical control + step-by-step generation". The following are alternative solutions or implementation methods: 1. Alternative organizational structure: Use a directed graph instead of a tree structure. The document content can be organized into a directed acyclic graph. Not only do the nodes support parent-child hierarchical relationships, but cross-node references or additions are also allowed. This is used to handle situations where there are dependencies or reuse relationships between technical points, further reducing the length of the generated document.

[0085] 2. Alternative search enhancement methods: Use rule matching or title indexing as the search method. In the context completion stage, instead of using semantic vector search, use keyword rules or paragraph titles for index filtering, which is helpful for deployment in resource-constrained scenarios or where the original material format is fixed.

[0086] 3. Instead of the point-by-point expansion method, use a backtracking generation strategy: First, generate a complete draft, then iteratively locate low-quality paragraphs in the draft and expand and optimize them. This "iterative correction" can also achieve a similar generation effect as the step-by-step expansion of the logical structure tree.

[0087] Although the above-mentioned alternative solutions differ from the present invention in their implementation, they can all achieve the invention's objective of improving the quality, accuracy, and completeness of document generation by expanding and optimizing the engineering document point by point in a logical structure tree manner to varying degrees. Therefore, they also fall within the scope of protection of the present invention.

Claims

1. A method for generating engineering documents based on a logical structure tree and LLM, characterized in that... Includes the following steps: S1. Document Parsing and Logical Structure Tree Initialization: The original material is parsed, divided into several text segments, and the text content of each segment is extracted to form an initial set of text segments X = {x1, x2, ..., x...} L The set X collectively encompasses all text content of the original material, including titles, abstracts, chapter names, main text, and formulas. L represents the total number of text segments, where a text segment refers to a content unit with relatively complete semantics obtained after parsing, corresponding to a natural paragraph or page in the original material. A logical structure tree for organizing and driving the engineering document generation process is initialized. This tree initially contains only a root node r representing the engineering document to be generated, and r's text description r.text and child node set r.child are both empty. S2. Logical Structure Tree Construction: Based on X and natural language prompts, the large language model is invoked to generate an initial draft of the technical content. draft Then from d draft Extract the logical structure and transform it into a tree structure to generate an initial logical structure tree T = (V, E, r). The logical structure contains several logical sub-units and the logical relationships between these logical sub-units. Each logical sub-unit covers a textual description of a concept definition, algorithm steps, or design details. V represents the set of nodes in T, and each non-root node corresponds to a logical sub-unit. E represents the set of directed edges between nodes in T, representing the logical relationships between nodes. S3. Recursive Expansion and Optimization of the Logical Structure Tree: Maintain a search queue storing all leaf nodes of the current logical structure tree, where the current logical structure tree is initially the initial logical structure tree T. For each leaf node in the search queue, first, through a retrieval enhancement mechanism, retrieve and obtain preliminary context information highly semantically related to its text description from the knowledge base built based on X. Then, filter the preliminary context information, removing context information already covered by its sibling nodes, and determine whether there is still retained context information after filtering. If not, terminate the process; if so, record the retained context information as d. ctx Next, determine d. ctx Whether it is covered by any other node in the current logical structure tree except for the set of child nodes of its parent node. If not covered, then based on d ctx The large language model is invoked to perform an expansion operation on the leaf node to generate its set of child nodes, and an optimization operation to optimize its text description. The newly generated leaf node is then added to the search queue. At the same time, the process is continuously monitored. If the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset total length threshold or the search queue is empty, the expansion and optimization process is terminated. S4. Preliminary Engineering Document Draft Generation: Based on the initial text segmentation set X and the expanded and optimized logical structure tree T. best It generates titles, abstracts, and project backgrounds by calling a large language model, and iterates through T... best Generate chapters on project content, project details, and key project points, and finally combine them into a preliminary project document draft Y.

2. The engineering document generation method based on logical structure tree and LLM according to claim 1, characterized in that... The specific process of step S3 is as follows: S3.

1. Initialize a search queue Q; then use T as the current logical structure tree, and add all leaf nodes of the current logical structure tree as candidate nodes for expansion and optimization to Q; S3.2 Determine if Q is empty. If it is empty, proceed to step S4. Otherwise, remove the candidate node v at the head of the queue from Q. t And record v t Parent node v f ; S3.3, Retrieve and obtain information related to v from the knowledge base built on X. t Text description v t First, obtain preliminary context information that is highly semantically relevant to the .text tag. Then, filter this preliminary context information to remove context information already covered by sibling nodes. Next, determine if any context information remains after filtering; if so, denote the remaining context information as d. ctx If so, proceed to step S3.4; otherwise, consider v to be... t No further expansion or optimization is needed; return to step S3.2 to continue execution. S3.4 Perform global deduplication, that is, determine the number of elements in the current logical structure tree except for v. f The set of child nodes v f Are there any nodes outside of .child that already contain d? ctx If so, then v is considered... t No further expansion or optimization is needed; return to step S3.2 to continue execution. Otherwise, proceed to step S3.5; S3.5, Call the large language model, based on d ctx , for v t Execute the expansion operation Expand(v) t To generate its set of child nodes v t .child, and perform the optimization operation Refine(v t To optimize its text description v t .text; then v t The newly generated leaf nodes in .child are added to Q as candidate nodes for expansion and optimization; then step S3.6 is executed. S3.

6. Evaluate the overall state of the current logical structure tree. If the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset overall length threshold, then proceed to step S4. Otherwise, return to step S3.2 and continue execution.

3. The engineering document generation method based on logical structure tree and LLM according to claim 2, characterized in that... In step S3.3, the process of building a knowledge base based on X is as follows: each text segment in X is mapped to an embedding vector using a vectorization tool; then, all embedding vectors are stored and an index is built using a vector search tool to form a knowledge base that supports highly semantically relevant retrieval.

4. The engineering document generation method based on logical structure tree and LLM according to claim 2, characterized in that... In step S3.3, the initial determination of context information is as follows: through relevance(a, v t (text) Calculate the relationship between each embedding vector a and v in the knowledge base. t The semantic relevance between .text tags, where relevance() calculates the relevance between a and v. t The semantic relevance between .text elements is calculated using a function; then, the text segments corresponding to the embedding vectors with semantic relevance higher than a preset relevance threshold are used as preliminary context information.

5. The engineering document generation method based on logical structure tree and LLM according to claim 4, characterized in that... In step S3.3, the process of removing context information already covered by sibling nodes at the same level is as follows: S3.3a. Construct a candidate set S from the preliminary context information; S3.3b. For any text segment b in S, calculate its filtering score F(b), F(b) = relevance(b, v t .text)-max(relevance(b,v e .text), v e Belongs to v f .child\{v t }), where v e .text represents v t sibling node v e The text description, v f .child is v f The set of child nodes, where \ indicates exclusion; S3.3c. If F(b) is less than the preset filtering threshold, then remove b from the candidate set S. S3.3d, After processing, the remaining text segments in S are the retained context information d. ctx .

6. The engineering document generation method based on logical structure tree and LLM according to claim 2, characterized in that... In step S3.5, Expand(v t The specific process is as follows: S3.5a, Call the large language model, using d ctx and extended natural language prompt words σ expand As input, generate v t Supplementary paragraphs to the .text file; S3.5b: Perform semantic segmentation and summarization on the supplementary paragraphs to extract several sub-points; S3.5c, Create a child node for each sub-point and use the text generated for each sub-point as the text description of the corresponding child node; S3.5d, Add all created child nodes to v in sequence. t In .child.

7. The engineering document generation method based on logical structure tree and LLM according to claim 2, characterized in that... In step S3.5, Refine(v t The specific process is as follows: S3.5e, Recognizing v t Key nouns in the .text that are not fully explained; S3.5f Determine whether the key term is a unique term in the original material. If so, first retrieve the text segment corresponding to the embedding vector related to the key term from the knowledge base through the retrieval enhancement mechanism, and then call the large language model and complete the description of the key term based on the retrieved text segment; otherwise, directly call the large language model to supplement the content of the key term. S3.5g, Update v t .text.

8. The engineering document generation method based on logical structure tree and LLM according to claim 1, characterized in that... In step S4, the preliminary engineering document draft Y includes a title, an abstract, and sections on engineering background, engineering content, engineering details, and engineering key points. The process of generating the title, abstract, and engineering background section is as follows: using X and relevant natural language prompts as input, a large language model is invoked to directly generate the title, abstract, and engineering background. The process of generating the project content chapters is as follows: (Based on T) best Starting from the root node, a breadth-first traversal is performed. Semantic judgment is performed using a large language model. Combined with the depth threshold of the logical structure tree and the overall length limit preset for Y, the logical subtree T that constitutes the core content of the project is dynamically determined. content Then for T content Perform a depth-first traversal, following the sequence "number + v". content Expand the text into a ".text" format and combine them to form the initial draft of the project content. content .text represents T content The text description of the nodes in the document is then used; a large language model is then called to generate a beneficial effect paragraph at the end of the initial draft of the project content, and to supplement the description of the project's advantages and value; finally, the large language model is called to polish the style, standardize the terminology, and optimize the structure to obtain the final project content. The process of generating engineering details is as follows: using T best Starting from the root node, a depth-first traversal is performed, expanding the data according to the format "number + v.text" to form an initial draft of engineering details covering all algorithm steps and design details, where v.text represents T. best The text description of the nodes in the process is then used; then, a large language model is called to polish the style, standardize the terminology, and optimize the structure of the initial draft of the engineering details, so as to obtain the final engineering details. The process of generating key project points is as follows: using T best Starting from the root node, a breadth-first traversal is performed. A large language model is used for semantic determination. Combined with the depth threshold of the logical structure tree and the overall length limit preset for Y, the logical subtree T that constitutes the key points of the project is dynamically determined. claim0 Then iterate through T. claim0 The leaf nodes, for each leaf node, in T best In the middle, locate the corresponding subtree with the root node, call the large language model, combine the text descriptions of all nodes in the subtree, and optimize the text description of the leaf node; then in T claim0 After optimizing the text descriptions of all leaf nodes, the optimized logical subtree T is obtained. claim1 Then for T claim1 Perform a depth-first traversal, following the sequence "number + v". claim1 Expand the text into a .text format and combine them to form a draft of the project key points. claim1 .text represents T claim1 The text descriptions of the nodes are then used; finally, a large language model is called to polish the style, standardize the terminology, and optimize the structure of the initial draft of the project key points, resulting in the final project key points. The generated title, abstract, project background, project content, project details, and project key points are combined according to the set project document chapter structure to obtain the preliminary project document draft Y.

9. A system for generating engineering documents based on a logical structure tree and LLM for implementing the method of any one of claims 1 to 8, characterized in that... include: The document parsing module is used to parse the original material, divide it into several text segments, and extract the text content of each text segment to form an initial text segment set X. Here, the text segment refers to a content unit with relatively complete semantics obtained after parsing, which corresponds to a natural paragraph or a page in the original material. The document knowledge base module is used to map each text segment in the initial text segment set X into an embedding vector, and then store all embedding vectors and build an index to form a knowledge base that supports highly semantically relevant retrieval. The retrieval enhancement module is used to retrieve and obtain contextual information that is highly semantically related to the textual description of a given node from the knowledge base; The logical structure tree maintenance module is used to perform the following operations: (a) Based on the initial text segment set X, and by calling the large language model, an initial logical structure tree T is generated; (b) Maintain a search queue containing all unprocessed leaf nodes in the current logical structure tree; (c) For each leaf node in the search queue, the retrieval enhancement module is invoked to obtain preliminary context information that is highly semantically related to its text description; then, the preliminary context information is filtered to remove context information already covered by its sibling nodes; then, it is determined whether there is still retained context information after filtering. If so, the retained context information is recorded as d. ctx Next, a global deduplication check is performed, that is, the check d is performed. ctx Whether it is covered by any other node in the current logical structure tree except for the set of child nodes of its parent node. If not covered, then based on d ctx The large language model is invoked to perform an expansion operation on the leaf node to generate its set of child nodes, and an optimization operation is performed to optimize its text description. The newly generated leaf node is then added to the search queue. (d) Monitor the current logical structure tree and the search queue. When the total number of characters or words in the text description of all non-root nodes in the current logical structure tree has reached the preset total length threshold or the search queue is empty, terminate the expansion and optimization process. The document generation module is used to generate a document based on the initial text segment set X and the logical structure tree T obtained after expansion and optimization by the logical structure tree maintenance module. best It generates titles, abstracts, and project backgrounds by calling a large language model, and iterates through T... best Generate chapters on project content, project details, and key project points, and finally combine them into a preliminary project document draft Y.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that... When the computer program is executed by a processor, it implements the method of any one of claims 1 to 8.

Citation Information

Cited By

  • Document knowledge tree generation and interactive exploration method and system based on artificial intelligence

    CN122152825A