Method for automatically generating complex-structure document based on large-model multi-agent

By employing a large-scale model multi-agent approach, document templates are mapped to compressed structural label sequences for semantic understanding and structural analysis. This generates execution plans, constructs directed acyclic graphs, and generates content through collaborative iteration of agents. This solves the alignment and constraint problems in generating structurally complex documents, thereby improving generation quality and efficiency.

CN121835641APending Publication Date: 2026-04-10GUANGXI UNIV OF FOREIGN LANGUAGES
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGXI UNIV OF FOREIGN LANGUAGES
Filing Date
2025-12-26
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies suffer from structural impedance mismatch, difficulty in semantic and layout alignment in zero-sample scenarios, and difficulty in guaranteeing hard constraints when generating complex documents, resulting in structural misalignment, non-standard content, and low usability of the generated results.

Method used

A large-model, multi-agent approach is adopted. The original structured document template is mapped to a compressed structure tag sequence. The structure planning agent performs semantic understanding and structural analysis to generate a structured execution plan. A field dependency directed acyclic graph is constructed. The content generation agent and the symbol verification agent work together to iteratively generate content that meets the preset constraints.

Benefits of technology

It enables accurate understanding and generation of complex documents under zero-sample conditions, improving the generation quality, compliance, and delivery efficiency of structured documents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121835641A_ABST
    Figure CN121835641A_ABST
Patent Text Reader

Abstract

The invention is applicable to the technical field of artificial intelligence, and provides a large-model multi-agent-based method for automatically generating a complex-structure document, which comprises the following steps of: mapping an original structured document template into a compressed structure mark sequence with a reserved layout, and performing zero-sample semantic understanding and planning through a structure planning agent to obtain a complex-structure document; generating an atomic operation execution plan; according to the semantic logic relationship among the atomic operations in the structured execution plan, constructing a field-dependent directed acyclic graph, carrying out topological sorting on the field-dependent directed acyclic graph, and determining an execution sequence of content generation; through collaborative iteration of the content generation agent and the symbol verification agent, each field content is generated under the condition that a hard constraint condition is met; and finally synthesizing a complete document. According to the method, accurate understanding, reliable generation and format guarantee of the complex document under the zero sample condition are realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, in particular to a large model multi-agent based structured complex document automatic generation method. BACKGROUND

[0002] With the progress of large language model technology, it has become an important application research direction in the field of natural language processing to automatically generate structured complex formatted documents such as business reports, legal contracts and course outlines. The current filling method is based on rules or pre-defined templates, which requires manual pre-definition of the format and position of all fields, and has limited flexibility and generalization ability. The second is a supervised training method based on deep learning, especially linearizing the document template into a long label sequence, and training the large language model on a large amount of labeled data in an end-to-end manner to generate a mixed content and bottom format code output sequence in a self-recurrent manner.

[0003] However, the document template with explicit two-dimensional spatial layout and deep nested structure is forced to be compressed into a one-dimensional sequence, which makes it difficult for the model to accurately perceive and reconstruct the original layout topology relationship, resulting in loss of structural information and impedance mismatch at the representation level. At the same time, the linear sequence contains a large number of redundant labels describing rendering details, which dilutes the signal of the core semantic fields in the long-range context, causing the attention of key semantic information to be missing in sparse text. Secondly, in the zero-shot or new template scenario, there is a lack of labeled data for fine-tuning, and the model has no explicit mechanism to automatically infer where to generate what content, making it difficult to align the semantic intent with the layout unit, and the generated results often have position errors. In addition, there are a large number of hard constraints in actual document generation, which cannot be strictly met through the probability prediction of the language model, resulting in poor compliance of hard constraints, and the generated results often need a lot of manual correction. The above problems together make it difficult to meet the requirements in terms of structural alignment accuracy, content generation compliance and direct usability of the final output when generating complex documents in a zero-shot condition. SUMMARY

[0004] The present application provides a large model multi-agent based structured complex document automatic generation method, which is used to solve the problems of structural misplacement, non-standard content and low usability caused by structural impedance mismatch, semantic and layout alignment difficulty in zero-shot and hard constraint difficulty to guarantee. Different from the existing supervised training based method, the present application proposes a zero-shot generation framework without training, which realizes accurate understanding of complex document template structure, automatic alignment of semantic fields and layout units, and strict compliance of generated content to hard format and logical constraints through the introduction of multi-agent division of labor and cooperation and neural-symbol hybrid mechanism in the reasoning stage, thereby effectively improving the generation quality, compliance and delivery efficiency of structured documents in a zero-shot condition.

[0005] The application provides a large model multi-agent based structured complex document automatic generation method, comprising: obtaining an original structured document template and a user task description; mapping the original structured document template into a compressed structure mark sequence, the compressed structure mark sequence comprising a plurality of marks, wherein each mark corresponds to a space unit in the original structured document template; based on the compressed structure mark sequence and the user task description, performing semantic understanding and structure analysis by a structure planning agent to generate a structured execution plan composed of a plurality of atomic operations, wherein each atomic operation comprises a target position mark, an operation type and a semantic description; constructing a field dependency directed acyclic graph according to the semantic logical relationship between the atomic operations in the structured execution plan, and topologically sorting the field dependency directed acyclic graph to determine the execution order of content generation; cooperatively and iteratively outputting the final content of each field to be generated by a content generation agent and a symbol verification agent until the symbol verification is passed and the preset constraint condition is met; filling the final content of all fields into the corresponding target positions in the compressed structure mark sequence, and reconstructing into a complete structured document by inverse transformation and outputting.

[0006] Further, the mapping of the original structured document template into a compressed structure mark sequence comprises: extracting the two-dimensional coordinate information, span attribute and style attribute of all space units in the original structured document template, wherein the span attribute comprises row span and column span; based on the two-dimensional coordinate information, span attribute and style attribute of each space unit, generating a corresponding structured mark; wherein the structured mark is an independent semantic unit encoded in linear text form and containing corresponding space unit coordinates, span and style information; connecting all structured marks in the order determined by the spatial position relationship of the space units in the original structured document template to form a compressed structure mark sequence.

[0007] Further, the extraction of the two-dimensional coordinate information, span attribute and style attribute of all space units in the original structured document template comprises: identifying the two-dimensional grid coordinates occupied by each space unit in the original structured document template; determining the row span of each space unit in the row direction and the column span in the column direction; extracting a style attribute of each spatial unit, the style attribute including at least one of a font, a font size, a bold, an italic, an underline, a cell merge identification, or a title level identification.

[0008] Further, based on the structure mark sequence and the user task description, semantic understanding and structure analysis are performed by a structure planning intelligent agent to generate a structured execution plan composed of a plurality of atomic operations, including: identifying a fillable slot in the compressed structure mark sequence; based on the user task description and the context structure in the compressed structure mark sequence, inferring a corresponding semantic role for each identified fillable slot; generating a corresponding atomic operation according to the semantic role, the structural attribute of the fillable slot, and the position information in the compressed structure mark sequence, to constitute a structured execution plan; wherein the operation type of the atomic operation includes at least filling, skipping, or replacing.

[0009] Further, the generation of the corresponding atomic operation according to the semantic role, the structural attribute of the fillable slot, and the position information in the compressed structure mark sequence includes: determining the operation type of the atomic operation according to the structural attribute of the fillable slot; the structural attribute includes whether the fillable slot is a title unit, a table header unit, a body unit, or an example unit; if the fillable slot is a title unit or a table header unit, the operation type is determined to be skipping; if the fillable slot is an example unit, the operation type is determined to be replacing; if the fillable slot is a body unit or a blank unit to be filled, the operation type is determined to be filling; determining a corresponding target position mark in the compressed structure mark sequence for each atomic operation, and determining a semantic description of the atomic operation according to the semantic role.

[0010] Further, the generation of the corresponding atomic operation according to the semantic role, the structural attribute of the fillable slot, and the position information in the compressed structure mark sequence further includes: if a plurality of fillable slots that are structurally continuous and semantically related are identified, it is determined that the plurality of fillable slots constitute an associated semantic unit group; inferring an overall semantic theme for the associated semantic unit group; based on the overall semantic theme and the starting position of the associated semantic unit group, generating a main atomic operation with a general semantic description; For each sub-unit in the associated semantic unit group except the starting position, a subordinate atomic operation with a specific semantic description is generated based on the overall semantic theme and the local structural attributes and semantic roles of each sub-unit.

[0011] Further, the field dependency directed acyclic graph is constructed based on the semantic logical relationship between the atomic operations in the structured execution plan, and the topological sorting of the field dependency directed acyclic graph is performed to determine the execution order of content generation, including: analyzing the semantic description of each atomic operation in the structured execution plan; determining the dependency direction between the fields to be generated corresponding to different atomic operations based on the logical association between the semantic descriptions; constructing the field dependency directed acyclic graph by taking each field to be generated as a node and the dependency direction as a directed edge; topologically sorting the field dependency directed acyclic graph to obtain the execution order of content generation.

[0012] Further, the dependency direction between the fields to be generated corresponding to different atomic operations is determined based on the semantic logic between the semantic descriptions, including: if the field content referred to by the first semantic description logically constitutes the premise, summary or total of the field content referred to by the second semantic description, a dependency relationship is determined from the field corresponding to the first semantic description to the field corresponding to the second semantic description; if the field content referred to by two semantic descriptions belongs to the same theme and there is a sequence of unfolding, a dependency relationship is determined from the field that is structurally or logically leading to the subsequent field.

[0013] Further, the preset constraint conditions include hard constraint conditions checked by a symbol checking agent; the hard constraint conditions include at least one of the following: content length constraint, data format constraint, numerical range constraint and logical consistency constraint.

[0014] Further, the content generation agent and the symbol checking agent cooperatively and iteratively output the final content of each field to be generated, including: for the current field to be generated, the content generation agent generates candidate content based on the semantic description, the context information retrieved from the knowledge base, and the generated content of the dependent field; the symbol checking agent checks the candidate content based on the hard constraint conditions corresponding to the current field; if the check passes, the candidate content is taken as the final content of the current field; If the verification fails, the input of the content generation agent is updated according to the diagnostic information output by the symbol verification agent, and the generation and verification steps are repeatedly executed for iterative correction until the final content that passes the verification is output.

[0015] From the above technical solutions, the present application has the following advantages: The present application maps the original structured document template to a compressed structure mark sequence that preserves the two-dimensional layout topology, solving the problem of structural impedance mismatch of traditional template XML / HTML; through semantic understanding and structural analysis of the compressed mark sequence and user task description by the structure planning agent under zero sample, the fillable slot is automatically identified and its semantic role is inferred, and an atomic operation execution plan is generated, realizing the precise alignment of semantic fields and layout units; according to the semantic logic between atomic operations, a field-dependent directed acyclic graph is constructed, and the content generation order is determined through topological sorting, guaranteeing the logical coherence and generation efficiency of the document; the content generation agent and the symbol verification agent iteratively generate each field content until the preset constraint condition is met, and finally all generated content is filled back to the compressed mark sequence and reconstructed into a complete document by inverse transformation. Through the powerful generation and reasoning ability of the large language model, the present application realizes accurate understanding of complex document structure and effective guarantee of content logic consistency, significantly improving the generation quality, usability and delivery efficiency of structured and templated documents in zero sample scenarios. BRIEF DESCRIPTION OF DRAWINGS

[0016] Figure 1 The figure is a system architecture diagram of a structured complex document automatic generation method based on a large model multi-agent in the present application; Figure 2 The figure is a flowchart of a structured complex document automatic generation method based on a large model multi-agent in the present application; Figure 3 The figure is a flowchart of zero sample structure planning in the present application; Figure 4 The figure is a flowchart of the collaborative iteration of the content generation agent and the symbol verification agent in the present application. DETAILED DESCRIPTION

[0017] The terms "first", "second", "third", "fourth" and the like in the description of this application and in the claims hereof, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so termed herein is solely for descriptive purposes and not for prescribing sequential or chronological order to any embodiment. It is to be understood that the data used herein can be interchanged, where appropriate, to enable embodiments of the present application described herein to be carried out in sequences other than those illustrated or otherwise described herein. Further, the terms "comprise" and "comprising" and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, product or apparatus that comprises a list of steps or elements does not necessarily comprise only those steps or elements

[0018] Embodiment one The method of the present application is based on a multi-stage collaborative complete system architecture, which clearly defines the data flow and functional division from the original input to the final output. Please refer to Figure 1 , the whole process contains input layer, structure representation layer, zero sample planning layer, scheduling layer, neural symbol execution layer and output layer in turn. Among them, the structure representation layer is responsible for converting the long source code of the original template into a compact compressed structure tag sequence which retains the complete two-dimensional layout information; the zero sample planning layer automatically completes the alignment of semantic intent and layout unit under the condition of zero sample, generates a structured execution plan composed of atomic operation triples through semantic understanding and structure analysis of the sequence; the scheduling layer analyzes the semantic logic between atomic operations in the plan, constructs a field-dependent directed acyclic graph and determines the topological execution order; the neural symbol execution layer generates the final content item by item under the premise of meeting the hard constraints and semantic requirements through the collaborative iteration of content generation agent and symbol verification agent; each layer is connected in turn, and the output of the previous layer is taken as the input of the next layer, which together constitutes the data flow of automatic document generation. The following will be combined with the architecture, please refer to Figure 2 , the specific implementation of each step will be described in detail: S1. Obtain the original structured document template and user task description; The original structured document template refers to an electronic document containing explicit layout, style and space unit definition, such as a.docx format Word document using OpenXML standard, which defines the two-dimensional visual structure and format framework of the document through elements such as tables, cells, titles, paragraphs, etc. The user task description is provided in the form of natural language generation instructions, the core content of which includes task type, target field, key content points and optional format preferences. This step provides a determined structured carrier and explicit semantic intent input for subsequent intelligent processing.

[0019] S2. mapping the original structured document template to a compressed structure token sequence, the compressed structure token sequence comprising a plurality of tokens, wherein each token corresponds to a space unit in the original structured document template; This step is used to solve the structural impedance mismatching problem between large language models and long, nested original template codes. Through a transformation function, the original template is mapped to a compressed structure token sequence that is compact, linear, and explicitly encodes complete two-dimensional layout and style information . This sequence greatly reduces the amount of data while preserving the layout topology of the document without loss, providing a standardized input for subsequent agent processing. Here, a space unit refers to the smallest logical area in the document layout that has an independent position and can carry content, such as a table cell that can span multiple rows and columns, a paragraph, or a title. Each token in the compressed structure token sequence corresponds to a space unit and encapsulates the layout and style attributes of the unit in a structured linear text form.

[0020] This mapping process is implemented through the following sub-steps: 201. Extracting two-dimensional coordinate information, span attributes, and style attributes of all space units in the original structured document template, wherein the span attributes include row span and column span; 1. Identifying the two-dimensional grid coordinates occupied by each space unit in the original structured document template; 2. Determining the row span of each space unit in the row direction and the column span in the column direction; 3. Extracting the style attributes of each space unit, including at least one of the following: font, font size, bold, italic, underline, cell merge identification, or title level identification.

[0021] Specifically, the two-dimensional coordinates, span, and style attributes of all space units in the original structured document template are extracted by calling a document parsing library to parse the original template , the set of all space units corresponding to the set can be identified , and the complete attributes of any space unit in the set are extracted through the following operations: 1. Two-dimensional grid coordinate determination The starting position in the global document layout grid, the row index and the column index form a coordinate pair to define the two-dimensional layout position of the unit. 2. Span attribute analysis The occupied space range, the number of rows and the number of columns spanned in the vertical and horizontal directions are obtained. The coordinates and A single, unique, and precise two-dimensional region can be determined for any complex cell. 3. Style Attribute Extraction style attribute set It should include at least basic text styles such as font, font size, bold, italic, and underline, as well as structural distinguishing marks such as cell merging to indicate heading level.

[0022] 202. Based on the two-dimensional coordinate information, span attribute, and style attribute of each spatial unit, generate a corresponding structured markup; wherein, the structured markup is an independent semantic unit encoded in linear text form and containing the coordinates, span, and style information of the corresponding spatial unit; This step encapsulates the extracted discrete attributes into a unified, machine-readable text identifier for each spatial unit. Based on its attribute vector Generate corresponding structured tags . It is an independent semantic unit, carrying its own meaning. All key information is encoded in an easily parsed linear text format, explicitly recording attribute information. An example definition is: This format converts and compresses two-dimensional layout information and one-dimensional style sets into short text fragments, achieving information serialization and standardization.

[0023] 203. Connect all structured tags in the order determined by the spatial positional relationship of the spatial units in the original structured document template to form a compressed structured tag sequence.

[0024] The system is based on each spatial unit Determine the corresponding marker in the actual spatial location of the original template. The order of arrangement: row index Smaller units, their markings First in line; if If they are the same, then the column index Smaller units, their markings First come, first served. Following this rule, all structured tags... These are connected sequentially to form the final compressed structure marker sequence. ,in This represents the transformation function. The final sequence is obtained. Compared to the original template The source code is significantly compressed, and the explicit declaration of coordinates and spans decouples the document's layout topology from the rendering code, making it an ideal input for subsequent efficient analysis by intelligent agents.

[0025] S3. Based on the compressed structure label sequence and user task description, the structure planning agent performs semantic understanding and structure analysis to generate a structured execution plan consisting of multiple atomic operations, where each atomic operation includes a target location label, operation type and semantic description; The structural planning agent, without requiring any pre-labeled field-cell correspondence data, compresses structural label sequences... Encoded two-dimensional layout information and user task description The system deeply understands and analyzes the semantic intent, automatically generating a set of executable atomic operation sequences precisely bound to the template structure—a structured execution plan. Unstructured generation tasks are decomposed into a set of explicit instructions that can be executed sequentially or in parallel. Each atomic operation... Defined as a triple . Mark the target location, pointing to the compressed structure marker sequence. Specific markers in the template are used to uniquely determine the fill location in the original template; As an operation type, it defines the specific action to be performed at that location; Semantic description, expressed concisely in natural language, is a core requirement used to guide content generation. See also... Figure 3 The specific implementation process includes the following: 301. Identify fillable slots in a compressed structure marker sequence; 302. Based on the user task description and the context structure in the compressed structure tag sequence, infer the corresponding semantic role for each identified fillable slot; The system first traverses the compressed structure tag sequence. Each structured markup in Based on encoding information such as whether its content is empty, whether it contains placeholder text, and whether its style indicates a content area, all fillable slots are identified and recorded as a set. For each fillable slot Structural planning intelligent agent integrated user task description And the slot in the sequence The contextual structure is analyzed, such as the header text of the same table row, the title text above, and the style of adjacent cells. Reasoning is performed by calling a large language model to analyze each... Assign a semantic role This maps the user intent of the open domain to a specific structured location in the template.

[0026] 303. Generate corresponding atomic operations based on semantic roles, the structural attributes of fillable slots, and their position information in the compressed structural tag sequence to form a structured execution plan; wherein the operation types of atomic operations include at least filling, skipping, or replacing.

[0027] For each fillable slot, the system generates its corresponding atomic operation according to the following logic: 1. Determine the operation type of the atomic operation based on the structural attributes of the fillable slot; the structural attributes include whether the fillable slot is a title cell, table header cell, body cell, or sample cell; 2. If the fillable slot is a title cell or a header cell, then set the operation type to skip; 3. If the fillable slot is a sample cell, then the operation type is set to replacement; 4. If the fillable slot is a text cell or a blank cell to be filled, then set the operation type to fill; 5. Determine the target position marker in the compressed structure marker sequence for each atomic operation, and determine the semantic description of the atomic operation based on its semantic role.

[0028] Specifically, structural attributes characterize whether the slot is a title unit, header unit, sample unit, body unit, or blank unit. This determination is based on the analysis of the tag's style attributes and position. If a fillable slot is a title unit or header unit, it indicates that it is an inherent structural component of the template and should not be modified; therefore, the operation type will be... Select "Skip". If the fillable slot is a sample cell, it means the content at that position is sample text and needs to be overwritten by new content; therefore, the operation type will be changed. The operation has been confirmed as a replacement. If the fillable slot is a text cell or a blank cell to be filled, it indicates that completely new content needs to be generated at that location; therefore, the operation type will be changed. This is determined to be filling. For each atomic operation, a target position marker is determined within the compressed structure marker sequence, and the semantic description of the atomic operation is determined based on its semantic role. The slot is then used for filling. The corresponding position marker in As a target location marker for atomic operations ; and based on the inferred semantic roles Based on this, refine and expand it into a complete semantic description that guides the generation process. .

[0029] For multiple fillable slots that are structurally continuous and semantically related, the system adopts a hierarchical planning strategy: 1. If multiple fillable slots that are structurally continuous and semantically related are identified, then the multiple fillable slots are determined to constitute a group of associated semantic units. 2. deduce an overall semantic theme for the associated semantic unit group; 3. generate a master atomic operation with a generalized semantic description based on the overall semantic theme and the starting position of the associated semantic unit group; 4. for each sub-unit in the associated semantic unit group except the starting position, generate a subordinate atomic operation with a specific semantic description based on the overall semantic theme and the local structural attributes and semantic roles of each sub-unit.

[0030] Specifically, if multiple fillable slots are identified as being structurally continuous and semantically related, the multiple fillable slots are determined to constitute an associated semantic unit group. For example, the cells in the same table row are usually semantically related to the same theme. An overall semantic theme is deduced for the associated semantic unit group. The system comprehensively analyzes the user task description and the global position of the unit group in the template, an overall semantic theme is deduced, such as course assessment method details. A master atomic operation with a generalized semantic description is generated based on the overall semantic theme and the starting position of the associated semantic unit group. The starting slot of the group is taken as the target position, and the overall semantic theme is taken as the basis to generate a master atomic operation, whose semantic description is a generalization of the entire group task, such as summarizing the course assessment method and the composition of the score. For each sub-unit in the associated semantic unit group except the starting position, a subordinate atomic operation with a specific semantic description is generated based on the overall semantic theme and the local structural attributes and semantic roles of each sub-unit. For each sub-unit in the group, a subordinate atomic operation is generated based on the overall theme and its own specific role, such as the proportion of regular performance and the form of final exam, and the semantic description of the subordinate atomic operation is associated with but more specific than the semantic description of the master operation.

[0031] To illustrate the above logic, a scenario of generating a course outline is described: suppose there is a two-column table in the template, with the table headers being week and teaching content, and after parsing, two data rows (4 cells in total) are identified as fillable slots. According to the context of the table headers and the task description, the semantic roles are deduced as the first week, the first week content, the second week, and the second week content. Since they are structurally continuous and semantically related to the theme of teaching arrangement, they are determined to be an associated semantic unit group. The system will generate a master atomic operation, i.e., the target position: the first week cell, the semantic description: fill in the teaching schedule table, and three subordinate atomic operations, i.e., the target position: the remaining cells, the semantic description: fill in the first week content of the teaching schedule table, fill in the second week of the teaching schedule table, and fill in the second week content of the teaching schedule table.

[0032] S4. Based on the semantic logical relations between each atomic operation in the structured execution plan, a field dependency directed acyclic graph is constructed, and the field dependency directed acyclic graph is topologically sorted to determine the execution order of content generation; In a complex structured document, the contents of different semantic fields are not completely independent, but there are logical relations such as logical premise, cause and effect, or total and part. If the contents are generated at will without considering these relations, it is easy to cause information contradiction or logical confusion. Therefore, in this step, by analyzing the semantic intention carried by each atomic operation in the structured execution plan obtained in the previous step, the relations are explicitly mined and formalized, a field dependency directed acyclic graph is constructed, and by topologically sorting the graph, one or more feasible and logically constrained content generation execution orders are finally determined to ensure that each field is processed only after the contents of all dependent fields are generated, thereby ensuring the logical coherence of the whole document.

[0033] 401. Analyze the semantic description of each atomic operation in the structured execution plan; The system traverses each atomic operation in the execution plan , extracts the semantic description component in the triple . Each semantic description summarizes the content requirements of the corresponding field to be generated , thereby forming a set of semantic descriptions corresponding to the fields to be generated one by one.

[0034] 402. Based on the logical association between semantic descriptions, determine the dependency direction between the fields to be generated corresponding to different atomic operations; The system analyzes the logical relationship between the field contents referred to by any two semantic descriptions and , and determines the dependency direction according to the following rules: 1. If the field content referred to by the first semantic description logically constitutes the premise, summary or total of the field content referred to by the second semantic description, a dependency relation from the field corresponding to the first semantic description to the field corresponding to the second semantic description is determined; 2. If the field contents referred to by two semantic descriptions belong to the same topic and there is a sequence of expansion, a dependency relation from the field leading in structure or logic to the subsequent field is determined.

[0035] ​​​​Specifically, if the content of the field referred to by the first semantic description logically constitutes the premise, summary or overview of the content of the field referred to by the second semantic description, a dependency relationship is determined from the field corresponding to the first semantic description to the field corresponding to the second semantic description. For example, the field whose semantic description is the overall goal of the course logically precedes and governs the field whose semantic description is the specific teaching goal of the first chapter , thus establishing a dependency relationship → , which means that the generation of needs to know the content of . If the content of the fields referred to by two semantic descriptions belongs to the same topic and there is a sequence of development, a dependency relationship is determined from the field that leads in structure or logic to the subsequent field. For example, multiple fields belonging to the topic of introducing members of the project team, the field introducing the project manager usually precedes the field introducing the development engineer , thus establishing a dependency relationship → , which ensures that when describing the same topic, the generation of content follows the inherent logic or the inherent exposition order of the document. The system applies the above rules to explicitly express the implicit logical relationship as an explicit dependency edge by analyzing the keywords, context and domain knowledge of the semantic description.

[0036] 403. Build a field dependency directed acyclic graph with each field to be generated as a node and the dependency direction as a directed edge; 404. Topologically sort the field dependency directed acyclic graph to obtain the execution order of content generation.

[0037] The system takes all fields to be generated as a node set . For each group of dependency relationships determined in step 402 → , a directed edge is created from node to node , forming an edge set . Thus, a directed graph is constructed. To ensure that the graph can be topologically sorted, the system will detect whether there is a circular dependency in it. If a loop is detected, according to the predefined conflict resolution rules, some edge in the loop is disconnected until it becomes a directed acyclic graph. Finally, the directed acyclic graph Applying standard topological sorting algorithm, output one or more linear field sequence. This sequence is the execution order that the content generation agent and the symbol checking agent should strictly follow when they work together in the subsequent steps. This order ensures that when generating any field, all other fields on which it depends have been completed, thereby enforcing the logical consistency of the document content from the process.

[0038] S5. Iteratively output the final content of each field to be generated by the content generation agent and the symbol checking agent until it passes the symbol checking and meets the preset constraint conditions; Please refer to Figure 4 This step ensures that the final content of each field meets the dual goals of high-quality semantic expression and strict rule compliance through iterative modification by the content generation agent and the symbol checking agent. The iterative collaboration here means that the content generation agent generates candidate content, and the symbol checking agent conducts compliance review. If the review fails, the diagnostic information output by the symbol checking agent is used as feedback to drive the content generation agent to modify the content. This process is repeated until the content that passes the symbol checking and meets all preset constraint conditions is output.

[0039] In this embodiment, the preset constraint conditions include hard constraint conditions checked by the symbol checking agent. The hard constraint conditions include at least one of the following: content length constraint, data format constraint, numerical range constraint, and logical consistency constraint. These constraints are predefined according to the document type and user requirements at system initialization, forming rigid rule boundaries for the generated content. For example, the content length constraint means that the field text cannot exceed the physical capacity of the cell or the specified word limit; the data format constraint means that the content must comply with the specified date, number, currency, and other format specifications; the numerical range constraint means that the filled-in numbers must be within a reasonable preset interval; and the logical consistency constraint means that the terminology used in the same document must be consistent, the list items cannot contradict each other, and the associated numerical calculation results must be consistent.

[0040] To achieve the above goal, for the current field to be generated The system performs the following sub-steps: 501. For the current field to be generated, the content generation agent generates candidate content based on the semantic description, context information retrieved from the knowledge base, and the generated content of the dependent fields; 502. The symbol checking agent checks the candidate content based on the hard constraint conditions corresponding to the current field; 503. If the checking passes, the candidate content is used as the final content of the current field; 504.If the verification fails, the input of the content generation agent is updated according to the diagnostic information output by the symbol verification agent, and the generation and verification steps are repeatedly executed for iterative correction until the final content that passes the verification is output.

[0041] Specifically, the system takes the current field The semantic description in the corresponding atomic operation As the core clue, it retrieves the relevant background knowledge, example fragments or term definitions in the domain knowledge base by combining the generated content of all predecessor (dependent) fields in the field dependency directed acyclic graph as supplementary context, and integrates them into dynamic enhanced context information . Then, the content generation agent constructs the prompt word by combining the , and the user task description to generate the candidate content of the current field , where is the current iteration round. The candidate content and the set of hard constraint conditions applied to the field are input into the symbol verification agent. The verifier checks one by one according to the predefined rules, and outputs a Boolean verification result (pass / fail) and diagnostic information when is false.

[0042] If the verification passes, the current candidate content is determined as the final content of the field , and the process ends. If the verification fails, the system combines the diagnostic information output by the symbol verification agent with the original prompt word to form a new prompt word containing correction instructions, which drives the content generation agent to generate new candidate content again and sends it to the symbol verification agent for a new round of verification. This cycle continues until the text generated in a certain round passes all hard constraint verification or reaches the preset maximum number of iterations. The entire collaborative iteration process forms a correction guided by the symbol verification, which effectively constrains the generation ability of the neural network within the feasible solution space defined by the symbol rules, so as to reliably output the document content that is both semantically rich and strictly compliant.

[0043] S6. Fill the final content of all fields back into the corresponding target position in the compressed structure markup sequence, and reconstruct it into a complete structured document through inverse transformation and output.

[0044] Specifically, the system traverses each atomic operation in the structured execution plan ​ For each operation, the target position marker recorded in its triple is used to locate the corresponding unique structured marker in the compressed structured marker sequence , thus locating the corresponding spatial cell in the original template where the operation is performed. The system fills the final content text generated for the operation in step S5 into this spatial cell. This filling process not only injects the pure text, but also ensures the content fits the physical size of the cell, and maintains or applies the original style attributes of the cell as much as possible. When all the field contents of the atomic operations are filled, the system restores the filled compressed structured marker sequence to a concrete editable document format file by performing the inverse process of the mapping function . The final output structured document not only retains all the layout and format specifications of the original template, but also precisely embeds the semantic content that meets all the preset constraints and conforms to the user's intention, achieving high-quality end-to-end automated document generation.

[0045] It can be understood that those skilled in the art can combine various embodiments in each of the above embodiments according to the teachings of the above embodiments to obtain various embodiments of the technical solutions.

[0046] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A large model multi-agent based structural complex document automatic generation method, characterized in that, The method comprises the following steps: obtaining an original structured document template and a user task description; mapping the original structured document template into a compressed structure mark sequence, the compressed structure mark sequence comprising a plurality of marks, wherein each mark corresponds to a space unit in the original structured document template; based on the compressed structure mark sequence and the user task description, performing semantic understanding and structure analysis by a structure planning agent to generate a structured execution plan comprising a plurality of atomic operations, wherein each atomic operation comprises a target position mark, an operation type and a semantic description; constructing a field dependency directed acyclic graph according to the semantic logical relationship between the atomic operations in the structured execution plan, and topologically sorting the field dependency directed acyclic graph to determine the execution order of content generation; cooperatively and iteratively outputting the final content of each field to be generated by a content generation agent and a symbol verification agent until the content passes the symbol verification and meets the preset constraint condition; filling the final content of all fields into the corresponding target positions in the compressed structure mark sequence, and reconstructing into a complete structured document by inverse transformation and outputting.

2. The large model-based multi-agent structured complex document automatic generation method according to claim 1, characterized in that, The mapping of the original structured document template into a compressed structure mark sequence comprises: extracting the two-dimensional coordinate information, span attribute and style attribute of all space units in the original structured document template, wherein the span attribute comprises row span and column span; based on the two-dimensional coordinate information, span attribute and style attribute of each space unit, generating a corresponding structured mark; wherein the structured mark is an independent semantic unit encoded in linear text form and containing the coordinate, span and style information of the corresponding space unit; connecting all structured marks in the order determined by the spatial position relationship of the space units in the original structured document template to form a compressed structure mark sequence.

3. The large model-based multi-agent structured complex document automatic generation method according to claim 2, characterized in that, The extraction of the two-dimensional coordinate information, span attribute and style attribute of all space units in the original structured document template comprises: identifying the two-dimensional grid coordinates occupied by each space unit in the original structured document template; determining the row span of each space unit in the row direction and the column span in the column direction; extracting the style attribute of each space unit, the style attribute comprising at least one of the following: font, font size, bold, italic, underline, cell merging identification or title level identification.

4. The large model-based multi-agent structural complex document automatic generation method according to claim 1, characterized in that, The generation of a structured execution plan comprising a plurality of atomic operations based on the structure mark sequence and the user task description by a structure planning agent comprises: identifying the fillable slot in the compressed structure mark sequence; based on the user task description and the context structure in the compressed structure mark sequence, inferring the corresponding semantic role for each identified fillable slot; generating a corresponding atomic operation according to the semantic role, the structure attribute of the fillable slot and the position information in the compressed structure mark sequence to constitute a structured execution plan; wherein the operation type of the atomic operation comprises at least filling, skipping or replacing.

5. The large model-based multi-agent structural complex document automatic generation method according to claim 4, characterized in that, The generating of the corresponding atomic operation according to the semantic role, the structural attribute of the fillable slot and the position information in the compressed structural mark sequence comprises: determining an operation type of the atomic operation according to the structural attribute of the fillable slot; the structural attribute comprises whether the fillable slot is a title unit, a table header unit, a text unit or a sample unit; if the fillable slot is a title unit or a table header unit, determining the operation type as skipping; if the fillable slot is a sample unit, determining the operation type as replacing; if the fillable slot is a text unit or a blank unit to be filled, determining the operation type as filling; determining a target position mark corresponding to each atomic operation in the compressed structural mark sequence, and determining a semantic description of the atomic operation according to the semantic role.

6. The large model-based multi-agent structural complex document automatic generation method according to claim 5, characterized in that, The generating of the corresponding atomic operation according to the semantic role, the structural attribute of the fillable slot and the position information in the compressed structural mark sequence further comprises: if a plurality of fillable slots which are structurally continuous and semantically related are identified, determining that the plurality of fillable slots constitute an associated semantic unit group; inferred a whole semantic theme for the associated semantic unit group; generating a main atomic operation with a general semantic description based on the whole semantic theme and a starting position of the associated semantic unit group; for each sub-unit in the associated semantic unit group except the starting position, generating a subordinate atomic operation with a specific semantic description based on the whole semantic theme and the local structural attribute and semantic role of each sub-unit.

7. The large model-based multi-agent structural complex document automatic generation method according to claim 1, characterized in that, The constructing of the field dependency directed acyclic graph according to the semantic logical relationship between the atomic operations in the structured execution plan, and the topological sorting of the field dependency directed acyclic graph to determine the execution order of content generation comprises: analyzing the semantic description of each atomic operation in the structured execution plan; determining the dependency direction between the fields to be generated corresponding to different atomic operations based on the logical association between the semantic descriptions; constructing the field dependency directed acyclic graph by taking each field to be generated as a node and the dependency direction as a directed edge; topologically sorting the field dependency directed acyclic graph to obtain the execution order of content generation.

8. The large model-based multi-agent structural complex document automatic generation method according to claim 7, characterized in that, The determining of the dependency direction between the fields to be generated corresponding to different atomic operations based on the semantic logic between the semantic descriptions comprises: if the field content indicated by a first semantic description logically constitutes a premise, an outline or a summary of the field content indicated by a second semantic description, determining a dependency relationship from the field corresponding to the first semantic description to the field corresponding to the second semantic description; if the field content indicated by two semantic descriptions belongs to the same theme and there is a sequence of unfolding, determining a dependency relationship in which a field that is structurally or logically leading points to a subsequent field.

9. The large model-based multi-agent structural complex document automatic generation method according to claim 1, characterized in that, The preset constraint condition comprises a hard constraint condition checked by a symbol checking intelligent agent; the hard constraint condition comprises at least one of the following: a content length constraint, a data format constraint, a numerical range constraint and a logic consistency constraint.

10. The large model-based multi-agent structural complex document automatic generation method according to claim 9, characterized in that, The content generation agent and the symbol checking agent iteratively output the final content of each field to be generated, including: For the current field to be generated, the content generation agent generates candidate content according to the semantic description, the context information retrieved from the knowledge base, and the generated content of the dependent field; The symbol checking agent checks the candidate content based on the hard constraint conditions corresponding to the current field; If the check passes, the candidate content is taken as the final content of the current field; If the check fails, the input of the content generation agent is updated according to the diagnostic information output by the symbol checking agent, and the generation and checking steps are repeated to perform iterative correction until the final content that passes the check is output.

Citation Information

Cited By

  • A document automatic generation method and system based on a language generation model

    CN122263826A