Cross-document text generation method and device based on large language model and medium
By constructing a corpus summarization network and task execution sequences, and combining them with a large language model to generate text, the problems of logical coherence and creative generation in existing technologies are solved, thereby improving the efficiency and quality of knowledge work.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies cannot bridge the gap from information retrieval to knowledge creation in multi-document question answering, summarization, and AI content generation. The generated content has poor logical coherence and cannot understand the user's high-level creative goals, which affects the efficiency and quality of complex knowledge work.
A corpus summarization network is constructed using a pre-trained graph attention network. A corpus summarization vector is generated through a graph pooling layer. A task execution sequence is generated based on a target local network. A response text is generated through a large language model. Users are allowed to iteratively modify the execution plan to ensure logical coherence.
It has enabled AI to shift from passive response to proactive collaborative creation, improving the efficiency and output quality of complex knowledge work, and generating content with rigorous logic, creative depth, and customization.
Smart Images

Figure CN121638265A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text generation technology, and in particular to a method, device and medium for cross-document text generation based on a large language model. Background Technology
[0002] With the deepening of digital transformation, integrating information from massive amounts of documents and generating new content has become a key challenge in the field of artificial intelligence. To address this, various technical solutions have emerged, primarily multi-document question answering, multi-document summarization, and AI content generation. Multi-document question answering aims to find accurate answers for users from multiple documents. For example, it constructs a knowledge graph from multiple documents and designs a large language model agent to navigate on the graph, actively collecting scattered evidence to generate answers. Furthermore, it can fine-tune the model agent to enable it to actively generate a series of follow-up questions, thereby more efficiently collecting evidence to handle complex reasoning. Multi-document summarization focuses on extracting a core summary from a cluster of topic-related documents. For example, it constructs a large sentence relationship graph from all sentences in a document set and applies graph convolutional networks to identify the most important sentences from a global perspective to form the summary. AI content generation utilizes large language models to assist users in creating content. For example, users provide seed text containing topics and keywords, and the large language model, combined with preset templates, quickly generates content drafts.
[0003] While the aforementioned technologies have achieved some success in specific tasks, they generally suffer from common and deep-seated flaws. First, their essence is the extraction and splicing of information from multiple sources, failing to achieve a fundamental leap from information retrieval to knowledge creation, and unable to generate in-depth analytical text, thus affecting the quality of output. Second, these technologies are passive question-answering or summarizing tools, unable to understand the high-level and creative goals proposed by users, and directly modifying the generated content based on user feedback will directly affect the logical coherence of the final generated content, greatly limiting the output efficiency and quality of complex knowledge work. Summary of the Invention
[0004] To address the aforementioned technical issues, this invention provides a method, device, and medium for cross-document text generation based on a large language model. By analyzing the relationship information between documents and interacting with the user, iteratively generating a task execution sequence, it enables AI to shift from passive response to proactive collaborative creation, significantly improving the efficiency and output quality of complex knowledge work.
[0005] According to a first aspect of the present invention, a method for cross-document text generation based on a large language model is provided, comprising the following steps: S1, a pre-trained graph attention network is used to process the user-input corpus to obtain a corpus summarization network, and a corpus summarization vector corresponding to the corpus summarization network is constructed through a preset graph pooling layer; the corpus includes several original documents.
[0006] S2, when a text generation instruction is received from the user, the target local network corresponding to the text generation instruction is extracted from the corpus summarization network based on the corpus summarization vector, and a task execution sequence consisting of several sub-tasks is generated based on the topology information of the target local network.
[0007] S3, when executing each subtask according to the task execution sequence, generates the response text corresponding to each subtask through a preset large language model based on the original documents corresponding to the target local network and the relationship information between each original document in the corpus summary network, and integrates several response texts into an initial result text and feeds it back to the user; among them, the relationship information between the original documents includes the relationship type and the relationship weight.
[0008] S4. When a modification instruction is received from the user based on the initial result text input, the modification instruction is used as a new text generation instruction, and the process returns to steps S2-S4 until the final result text is output.
[0009] According to a second aspect of the present invention, a non-transitory computer-readable storage medium is provided, wherein at least one instruction or at least one program is stored therein, the at least one instruction or the at least one program being loaded and executed by a processor to implement the above-described cross-document text generation method based on a large language model.
[0010] According to a third aspect of the present invention, an electronic device is provided, including a processor and the aforementioned non-transitory computer-readable storage medium.
[0011] The present invention has at least the following beneficial effects: This invention provides a cross-document text generation method based on a large language model. First, a graph attention network is used to process the user-input corpus to obtain a corpus summarization network. Then, a graph pooling layer is used to construct corpus summarization vectors. These vectors not only contain the overall summarization distribution of the corpus but also quantify the deep semantic relationships between all document summarization vectors, constituting a global and structured understanding of the entire corpus knowledge system. Then, upon receiving a text generation instruction, a target local network is extracted from the corpus summarization network based on the corpus summarization vectors. Based on the topological information of the target local network, a task execution sequence is generated. By decomposing the instruction into an executable multi-step task sequence, the transformation of AI from passive response to active collaborative creation is realized, significantly improving the complexity of complex tasks. This improves the efficiency and quality of knowledge-based work. When executing each subtask, based on the original documents corresponding to the target local network and the relationships between these documents, a pre-defined large language model generates the response text for each subtask. This response text is then integrated into the initial result text and fed back to the user. The combination of the task execution sequence and the large language model ensures the logical rigor and sufficient evidence in the generated content, resulting in high accuracy and creative depth. When receiving modification instructions from the user, the task execution sequence is iteratively generated until the final result text is output. During user interaction, the generated result text is not directly modified; instead, the execution plan is revised, ensuring the consistency and logical coherence of the generated content and significantly improving the customization level and practicality of the final output. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 A flowchart of a cross-document text generation method based on a large language model provided in an embodiment of the present invention. Detailed Implementation
[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0015] This invention provides a cross-document text generation method based on a large language model, such as... Figure 1 As shown, the method includes the following steps: S1 uses a pre-trained graph attention network to process the user-input corpus to obtain a corpus summarization network, and constructs the corpus summarization vector corresponding to the corpus summarization network through a preset graph pooling layer. This can be understood as: using a graph pooling layer to aggregate the nodes in the corpus summarization network, compressing and encoding the information of the entire knowledge graph into a unique vector with a preset fixed dimension.
[0016] Specifically, the corpus includes several original documents; it can be understood as: the corpus is a collection of documents input by the user, and the document formats include, but are not limited to, PDF, DOCX, TXT and HTML.
[0017] Furthermore, the corpus summarization network is obtained through the following steps: S101, preprocess each original document in the corpus.
[0018] Specifically, the preprocessing includes, but is not limited to, text extraction, cleaning, and segmentation of the document.
[0019] S102, a pre-trained text summarization model is used to extract a summary from each pre-processed original document, generating a document summary vector corresponding to each original document. For example, the text summarization model can be a BART-large-cnn model or a PEGASUS model, used to generate a low-dimensional dense vector that can capture the core semantics of each original document, that is, to abstract each original document into a vector representation of its semantic core.
[0020] S103 uses the document summary vector corresponding to each original document as a node, and a pre-trained graph attention network is used to learn the relationship type and relationship weight between each pair of nodes. Based on all nodes and the relationship type and relationship weight between each pair of nodes, a corpus summary network is constructed. This can be understood as constructing a knowledge graph that includes relationship types and relationship weights.
[0021] Specifically, the set of relationship types between different nodes learned by the pre-trained graph attention network includes, but is not limited to, support type, rebuttal type, detailed explanation type, and case-providing type.
[0022] Furthermore, the process of learning the relationship type and relationship weight between every two nodes using a pre-trained graph attention network includes the following steps: S1031, initialize a fully connected graph by using the document summary vector corresponding to each original document as a node; where any two nodes are connected by an edge.
[0023] S1032, the fully connected graph is input into a pre-trained graph attention network. The attention mechanism of the graph attention network is used to calculate the relation weights corresponding to the edges between each pair of nodes, and the feature representation of each node is updated based on the relation weights corresponding to the edges between each pair of nodes. This can be understood as: using the relation weights to perform information transfer and aggregation between nodes, and generating an enhanced node representation containing full graph context information for each node.
[0024] Specifically, the attention mechanism of a graph attention network calculates the relation weights corresponding to the edges between every two nodes, which satisfy the following conditions: Where, α ij d represents the relation weight corresponding to the edge between the i-th node and the j-th node. i d j and d k Let represent the vector representations corresponding to the i-th node, the j-th node, and the k-th node, respectively. It is a learnable weight matrix used to perform linear transformations on vectors. This indicates the concatenation of vectors. It is a learnable weight matrix. yes transpose, Let represent the set of neighboring nodes of the i-th node, LeakyReLU() is the preset non-linear activation function, and exp() is the natural exponential function.
[0025] S1033: For any two connected nodes, combine the feature representations corresponding to the two connected nodes to generate the corresponding edge feature representation, and input the edge feature representation into the relationship classifier embedded in the graph attention network to output the relationship type between the two connected nodes.
[0026] As described above, by setting multiple relationship types and using a trained graph attention network to learn the relationship type and weight between each pair of nodes, the complex relationships between documents can be dynamically captured. This makes the corpus summarization network contain richer information about the mutual information between documents, so that the constructed corpus summarization vectors not only contain the overall topic distribution of the corpus, but also encode the complex network structure of mutual support and refutation between different documents. It is not simply encoding the content of a single document, but capturing and quantifying the deep semantic relationships between all document summarization vectors, thus constituting a global and structured understanding of the entire corpus knowledge system.
[0027] S2, when a text generation instruction is received from the user, the target local network corresponding to the text generation instruction is extracted from the corpus summarization network based on the corpus summary vector, and a task execution sequence consisting of several sub-tasks is generated based on the topology information of the target local network; it can be understood that the topology information of the target local network refers to the node information contained in the target local network and the information on the relationship types and relationship weights between the nodes.
[0028] Specifically, step S2 includes the following steps: S201, a pre-defined natural language understanding unit parses and vectorizes the user-input text generation command, matches the converted vector with the corpus summary vector, and locates the matching result from the corpus summary vector. This can be understood as calculating the semantic similarity between the relational information between the original documents encoded in the corpus summary vector and the converted vector, for example, calculating the cosine similarity between the vectors. In a specific embodiment, when a user inputs a high-level command with a creative goal, "Help me write a risk report," the natural language understanding unit of the large language model parses the command into a structured target representation, and queries the corpus summary vector using the parsing result. This allows the identification of subsets of original documents on topics such as supply chain disruptions and competitor dynamics, and the corresponding locations of their relational information.
[0029] S202, based on the matching results located from the corpus summary vector, maps the target local network corresponding to the text generation instruction in the corpus summary network.
[0030] S203, based on the relationship information between the original documents corresponding to every two nodes in the target local network, generates a task execution sequence through a pre-trained path planner. For example, when identifying a subset of original documents on topics such as supply chain disruptions and competitor dynamics, and the relationship information between them, the path planner generates an ordered execution plan consisting of multiple sub-tasks, such as synthesizing content related to supply chain disruptions and then synthesizing content related to competitor dynamics.
[0031] As described above, upon receiving a user's text generation instruction, the instruction is first parsed. Based on the parsing results, related original documents and the relationship information between them are found from the corpus summarization network. Based on the logical information between these documents, the user's fuzzy, high-level creative task objective can be transformed into a specific, structured, machine-executable multi-step task sequence. This enables AI to shift from passive response to proactive collaborative creation, and can be directly applied to various knowledge-intensive tasks such as research reports and survey plans, thereby significantly improving the efficiency and output quality of complex knowledge work.
[0032] Furthermore, the path planner generates a task execution sequence according to the following rules: S2031: The centrality of each node in the target local network is calculated based on the path planner to determine the target node from the target local network. In specific implementation, when at least one target node is determined, steps S2032 to S2034 are executed separately for each target node. Finally, the task execution sequences corresponding to each target node are integrated through a large language model. Those skilled in the art are familiar with the method of calculating node centrality, and it will not be described in detail here.
[0033] S2032, based on the relationship type between each non-target node and the target node in the target local network, divide the network into several relationship clusters; this can be understood as: different relationship clusters correspond to different relationship types. For example, all non-target nodes whose relationship type with the target node is the "support" type are grouped into one relationship cluster.
[0034] Specifically, the non-target node is any node in the target local network other than the target node itself.
[0035] S2033, for any relation cluster, sort the non-target nodes corresponding to the relation cluster in descending order of relation weight to obtain the node sequence corresponding to the relation cluster. For example, the non-target nodes that constitute a supporting type based on the relationship with the target node are sorted in descending order of their weights.
[0036] S2034: Obtain the sorting result of the node sequence corresponding to the relation cluster according to the preset sorting rule corresponding to the relation type. Based on the sorting result of the node sequence, determine the sorting result of the subtask corresponding to each non-target node, and place the subtask corresponding to the target node at the beginning of the sequence to generate the task execution sequence. This can be understood as: first, place the subtask corresponding to the target node at the beginning of the sequence, then sort the relation cluster according to the preset sorting rule, and then obtain the final task execution sequence based on the subtask corresponding to the sorted node sequence in each relation cluster. The subtasks corresponding to the target node and the non-target node are obtained by performing semantic association analysis on the document summary vector corresponding to each node and each subtask according to the large language model.
[0037] As described above, when generating the task execution sequence, the first target node is determined, then the relationship clusters are divided according to the relationship type, and the nodes in the same relationship cluster are sorted according to different relationship weights. Then, the relationship clusters are sorted according to the preset sorting rules, so that the final generated task execution sequence is more reasonable and logically complete, ensuring the creative depth and logical accuracy of the subsequently generated content.
[0038] S3, when executing each subtask according to the task execution sequence, generates the response text corresponding to each subtask through a preset large language model based on the original documents corresponding to the target local network and the relationship information between each original document in the corpus summary network, and integrates several response texts into an initial result text and feeds it back to the user; among them, the relationship information between the original documents includes the relationship type and the relationship weight.
[0039] Specifically, step S3 includes the following steps: S301, when executing each subtask, determine the original documents corresponding to each subtask from the original documents corresponding to all nodes in the target local network.
[0040] S302 involves extracting text relevant to each subtask from several original documents corresponding to each subtask using a pre-defined large language model. This extracted text is then integrated to obtain the response text for each subtask. In essence, the pre-defined large language model analyzes semantic matching to extract text relevant to the subtask and generates the response text through semantic analysis and natural language processing. For example, when the subtask is "synthetic response strategy section," the content of documents marked as providing case types or detailed explanations will be prioritized for integration.
[0041] S303. Based on the task execution sequence and the relationship information between several original documents corresponding to each subtask, the response text corresponding to each subtask is sorted and re-integrated using a pre-set large language model to obtain the initial result text.
[0042] As described above, when generating the response text for each subtask, the most relevant information is retrieved from the corpus summarization network and the original document as context based on the current subtask. That is, not only is the text extracted from the original document, but the relational information obtained from the corpus summarization network is also used to guide the large language model in generating the response text, thereby ensuring that the generated content is logically rigorous, well-supported, and has high accuracy and depth.
[0043] S4: When a modification instruction is received from the user based on the initial result text input, the modification instruction is treated as a new text generation instruction, and the execution steps S2-S4 are returned until the final result text is output. This can be understood as parsing the modification instruction and converting it into a modification instruction for the task execution sequence, triggering the regeneration of the task execution sequence. For example, if the user inputs a modification instruction such as "The analysis of competitor A in Part Three is not in-depth enough; add the market share data from reports B and C," the pre-defined natural language understanding unit will parse this instruction into a structured editing command. After receiving the editing command, the system will not directly perform simple editing or insertion operations on the generated initial result text, but will update or correct the original execution plan based on the editing command. In specific implementations, this process can be iterated multiple times until the user is satisfied with the final output.
[0044] As mentioned above, when a modification instruction is received from the user, it does not directly affect the surface text, but rather the underlying execution plan. It also allows the user to make multiple rounds of fine-grained modifications and improvements to the output text. This deep iterative revision mechanism ensures that all modifications are consistent with the overall structure and logic of the document, avoids the content disconnect caused by fragmented modifications, guarantees the consistency and logical coherence of the generated content, and significantly improves the customization level and practicality of the final output.
[0045] In another implementation, step S4 can also be replaced by the following steps: S10, when a modification instruction is received from the user based on the initial result text input, the modification instruction is used as a new text generation instruction, and the process returns to step S2 to generate a new task execution sequence.
[0046] S20: Compare the new task execution sequence with the original task execution sequence. Take the first subtask in the new task execution sequence that is out of order from the original task execution sequence as the starting point, and re-execute the subtasks from the starting point to the last subtask in the new task execution sequence to obtain the response text corresponding to each re-executed subtask. For example, a new subtask may be inserted into the original task execution sequence, and then the affected subsequent tasks may be re-executed, while tasks located before the inserted subtask do not need to be re-executed.
[0047] S30: Based on the order of each subtask in the new task execution sequence, the response text corresponding to each re-executed subtask is integrated with the response text corresponding to each non-re-executed subtask in the new task execution sequence through a preset large language model. After obtaining the new result text, it is fed back to the user, and the execution steps S10-S30 are returned until the final result text is output.
[0048] As described above, when readjusting the task execution sequence according to the modification instructions, it is not necessary to re-execute all subtasks. Only the subtasks affected by the modification process need to be re-executed. While ensuring that all modifications are consistent with the overall structure and logic of the document, task execution efficiency is improved, and deep and coherent content iteration is achieved.
[0049] Embodiments of the present invention also provide a non-transitory computer-readable storage medium, which can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method in the method embodiments, wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the cross-document text generation method based on a large language model provided in the above embodiments.
[0050] Embodiments of the present invention also provide an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.
[0051] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. It should also be understood that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.
Claims
1. A cross-document text generation method based on a large language model, characterized by, The method comprises the following steps: S1, using a pre-trained graph attention network to process a corpus input by a user to obtain a corpus summary network, and constructing a corpus summary vector corresponding to the corpus summary network through a preset graph pooling layer; the corpus comprises a plurality of original documents; S2, when receiving a text generation instruction input by the user, extracting a target local network corresponding to the text generation instruction from the corpus summary network based on the corpus summary vector, and generating a task execution sequence composed of a plurality of sub-tasks based on topological information of the target local network; S3, when each sub-task is executed according to the task execution sequence, generating a reply text corresponding to each sub-task through a preset large language model according to relationship information between original documents corresponding to the target local network and each original document in the corpus summary network, and integrating a plurality of reply texts into an initial result text and feeding back to the user; wherein the relationship information between the original documents comprises a relationship type and a relationship weight; S4, when receiving a modification instruction input by the user based on the initial result text, taking the modification instruction as a new text generation instruction, and returning to execute steps S2-S4 until outputting a final result text.
2. The cross-document text generation method based on a large language model according to claim 1, characterized in that, In step S1, the corpus summary network is obtained by the following steps: S101, preprocessing each original document in the corpus; the preprocessing comprises text extraction, cleaning and segmentation operations; S102, using a pre-trained text summary model to extract summaries from each preprocessed original document to generate a document summary vector corresponding to each original document; S103, taking each document summary vector corresponding to each original document as a node, using a pre-trained graph attention network to learn the relationship type and the relationship weight between each two nodes, and constructing the corpus summary network based on all nodes, the relationship type and the relationship weight between each two nodes.
3. The cross-document text generation method based on a large language model according to claim 2, characterized in that, The set of relationship types learned by the pre-trained graph attention network between different nodes includes support type, refutation type, detailed elaboration type and case providing type.
4. The cross-document text generation method based on a large language model according to claim 2, characterized in that, The pre-trained graph attention network learns the relationship type and the relationship weight between each two nodes, comprising the following steps: S1031, taking each document summary vector corresponding to each original document as a node, initializing to obtain a full connection graph; wherein any two nodes are connected by an edge; S1032, inputting the full connection graph into the pre-trained graph attention network, calculating the relationship weight corresponding to the edge between each two nodes through the attention mechanism of the graph attention network, and updating the feature representation of each node based on the relationship weight corresponding to the edge between each two nodes; S1033, for any two connected nodes, combining the feature representations corresponding to the two connected nodes to generate a corresponding edge feature representation, and inputting the edge feature representation into a relationship classifier embedded in the graph attention network to output the relationship type between the two connected nodes.
5. The cross-document text generation method based on a large language model according to claim 3, characterized in that, Step S2 comprises the following steps: S201, a preset natural language understanding unit is used to parse and vectorize convert the text generation instruction input by the user, match the converted vector with the corpus summary vector, and locate the matching result from the corpus summary vector; S202, based on the matching result located from the corpus summary vector, a target local network corresponding to the text generation instruction in the corpus summary network is mapped out; S203, based on the relationship information between the original documents corresponding to each two nodes in the target local network, a task execution sequence is generated by a pre-trained path planner.
6. The cross-document text generation method based on a large language model according to claim 5, characterized in that, In step S203, the path planner generates the task execution sequence by the following rules: S2031, the centrality of each node in the target local network is calculated based on the path planner to determine the target node from the target local network; S2032, according to the relationship type between each non-target node and the target node in the target local network, a plurality of relationship clusters are divided; the non-target node is any node in the target local network except the target node itself; S2033, for any relationship cluster, the non-target nodes corresponding to the relationship cluster are sorted according to the order of relationship weight from high to low, and the node sequence corresponding to the relationship cluster is obtained; S2034, the sorting result of the node sequence corresponding to the relationship cluster is obtained according to the preset sorting rule corresponding to the relationship type, the sorting result of the subtask corresponding to each non-target node is determined based on the sorting result of the node sequence, and the subtask corresponding to the target node is placed at the first position of the sequence, and the task execution sequence is generated.
7. The large language model-based cross-document text generation method according to claim 1, characterized in that, Step S3 includes the following steps: S301, when each subtask is executed, a plurality of original documents corresponding to each subtask are determined from a plurality of original documents corresponding to all nodes in the target local network; S302, the text related to the subtask itself is extracted from the plurality of original documents corresponding to each subtask by a preset large language model, and the extracted text is integrated to obtain the reply text corresponding to each subtask; S303, according to the task execution sequence and the relationship information between the plurality of original documents corresponding to each subtask, the reply text corresponding to each subtask is sorted and integrated again by a preset large language model to obtain an initial result text.
8. The large language model-based cross-document text generation method according to claim 1, characterized in that, Step S4 can also be replaced by the following steps: S10, when receiving the modification instruction input by the user based on the initial result text, the modification instruction is taken as a new text generation instruction, and step S2 is returned to generate a new task execution sequence; S20, the new task execution sequence is compared with the original task execution sequence, the first subtask in the new task execution sequence which is different from the original task execution sequence in order is taken as a starting point, and the new task execution sequence from the starting point to the last subtask is re-executed to obtain the reply text corresponding to each re-executed subtask; S30, based on the order of each subtask in the new task execution sequence, integrating the reply text corresponding to each re-executed subtask with the reply text corresponding to each subtask not re-executed in the new task execution sequence through the preset large language model to obtain a new result text, feeding back to the user, and returning to steps S10-S30 until the final result text is output. 9.A non-transitory computer-readable storage medium having stored therein at least one instruction or at least one piece of program, characterized in that, The at least one instruction or the at least one program is loaded and executed by the processor to implement the cross-document text generation method based on the large language model as claimed in any one of claims 1-8.
10. An electronic device, comprising: The non-transitory computer-readable storage medium as claimed in claim 9 is included in the processor.