Document generation method and system based on self-evolution intelligent agent
By constructing a document generation system with a self-evolving intelligent agent, the problem of insufficient personalization adaptation in existing technologies is solved. This enables autonomous optimization and continuous adaptation of document generation, improves the matching degree of user needs, and reduces manual modification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-04
- Publication Date
- 2026-03-31
AI Technical Summary
Existing document generation systems lack personalization and adaptation capabilities, and cannot continuously optimize themselves based on user feedback, resulting in generated reports requiring extensive manual modification to meet actual needs.
A document generation system based on a self-evolving intelligent agent is constructed. Through data acquisition and processing, template and prompt word initialization, document generation, user interaction, self-evolution and long-term memory modules, a closed-loop process of "data acquisition - prompt word optimization - document generation - user feedback - iterative learning" is formed, and prompt words are dynamically optimized to adapt to user needs.
It enables autonomous and continuous optimization of the document generation process, significantly improving the matching degree between output content and user needs, and reducing manual modification costs.
Smart Images

Figure CN121766288A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence application technology, and in particular to a document generation method and system based on a self-evolving intelligent agent. Background Technology
[0002] In the field of document generation, existing technologies largely focus on template-based and large-scale model-based document generation systems. These systems have significant limitations: First, they lack personalization capabilities. Different industries, or even different users within the same industry, have varying writing habits, priorities, levels of detail, and expression styles. Existing systems often use uniform templates or limited custom configurations, making it difficult to accurately match diverse personalized needs. This results in generated reports still requiring extensive manual modification to meet actual usage requirements. Second, they lack continuous evolution capabilities. The document generation logic of existing systems is mostly based on preset rules or fixed prompts, unable to dynamically optimize based on user feedback. When business scenarios change or user needs adjust, the system struggles to adapt and upgrade, requiring manual iteration by technical personnel, leading to high maintenance costs and slow response times.
[0003] As a cutting-edge concept in the field of artificial intelligence, self-evolving intelligent agents are defined at their core as intelligent units with a closed-loop capability of "perception-decision-learning-iteration." They can autonomously optimize their behavioral strategies through environmental interaction or human feedback, breaking free from the dependence of traditional AI on fixed rules and massive labeled samples. In the field of document generation, the application of self-evolving intelligent agents is still in its early stages: existing research largely focuses on single-dimensional data processing optimization, failing to form a self-evolving architecture covering the entire process of "data acquisition-document generation-feedback iteration." Furthermore, most solutions only use numerical scoring to drive evolution, failing to accurately capture the deep-seated needs contained in the natural language feedback in document generation scenarios. This leads to a disconnect between the evolutionary direction and actual business needs, making it difficult to achieve truly personalized adaptation and continuous upgrading.
[0004] Therefore, how to build a document generation system that can accurately adapt to personalized needs and has the ability to self-evolve based on user feedback has become an urgent problem to be solved in the technology field. Summary of the Invention
[0005] The purpose of this invention is to provide a document generation method and system based on a self-evolving intelligent agent, which solves the problems of insufficient personalization adaptation capability and inability to continuously optimize based on user feedback in existing document generation systems.
[0006] To achieve the above objectives, this invention provides a document generation method based on a self-evolving intelligent agent, comprising the following steps: S1: Collects and processes multi-source data through the data acquisition and processing module, and outputs standardized data; S2: Initialize the module using templates and prompts to obtain the initial prompts and document templates corresponding to the business scenario; S3: Using the document generation module, based on the standardized data, target prompt words, and the document template, call the large language model to generate document content; S4: Display the document content to the user through the user interaction module, and receive user-submitted comments or suggestions for modifying prompts; S5: Based on the current user feedback and historical data stored in the long-term memory module, the self-evolution module generates optimized target prompt words and stores them in the long-term memory module. S6: Return to step S3, regenerate the document content based on the optimized target prompt words, and repeat steps S4 to S6 until the user confirms that the document content meets the requirements. S7: Store the target prompts, user feedback, and final document content of this process through the long-term memory module.
[0007] Specifically, the data acquisition and processing module collects and processes multi-source data to output standardized data, including: Collect structured and unstructured data; The structured data is parsed; For the unstructured data, a text recognition model or a speech recognition model is used to convert it into text, and a large language model is used to extract key information from the text. The parsed structured data and extracted key information are organized into structured data, which serves as the data source for document generation.
[0008] Specifically, the template and prompt word initialization module obtains the initial prompt words and document templates corresponding to the business scenario, including: The initial prompt word adopts a prompt structure of system instruction + scene parameters + example guidance, wherein the scene parameters are used to call the standardized data, and the example guidance is generated based on the historical document content stored in the long-term memory module.
[0009] Specifically, the document generation module, based on the standardized data, target prompts, and the document template, calls a large language model to generate document content, including: Large language models can be deployed locally or invoked via secure application programming interfaces; The standardized data is injected into the context of the target prompt words, and combined with the structure and specifications of the document template, the large language model is guided to generate document content; Record the data source, prompt word version, template identifier, and model information used when generating the document content, and bind and store the information with the generated document content.
[0010] The document content is displayed to the user through a user interaction module, and user-submitted feedback or suggestions for modification are received. Specifically, this includes: The user interaction module provides an interface that includes document preview, evaluation input, and version comparison functions, and is used to receive multi-dimensional evaluations of the document content and specific suggestions for modifying prompts.
[0011] Specifically, the self-evolution module generates optimized target prompts based on current user feedback and historical data stored in the long-term memory module, and stores them in the long-term memory module. This includes: The system acquires real-time feedback information from the user interaction module and historical data retrieved from the long-term memory module that is associated with the current user and the prompt word version, forming an iterative information data package. Based on preset prompt words, the large language model is driven to analyze and reason about the iterative information data packet to generate the optimized target prompt words; The generated optimized target prompts are validated for logical consistency and format compliance. Once the validation is successful, they are synchronized to the document generation module, and the record of this iteration is stored in the long-term memory module.
[0012] A document generation system based on a self-evolving intelligent agent includes a data acquisition and processing module, a template and prompt word initialization module, a document generation module, a user interaction module, a self-evolving module, and a long-term memory module. The data acquisition and processing module is connected to both the template and prompt word initialization module and the long-term memory module. The template and prompt word initialization module is connected to the data acquisition and processing module, the document generation module, and the long-term memory module. The document generation module is connected to the template and prompt word initialization module, the user interaction module, and the long-term memory module. The user interaction module is connected to both the document generation module and the self-evolving module. The self-evolving module is connected to both the user interaction module and the long-term memory module. The long-term memory module is connected to both the data acquisition and processing module, the document generation module, the template and prompt word initialization module, and the self-evolving module. The data acquisition and processing module is used to acquire and process multi-source data and output standardized data. The template and prompt initialization module is used to receive the standardized data and provide initial prompts and document templates; The document generation module is used to generate document content by calling a large language model based on the standardized data, the target prompt words obtained from the long-term memory module, and the document template. The user interaction module is used to display the document content to the user and receive user-submitted evaluations or suggestions for modifying prompts. The self-evolution module is used to generate optimized target prompt words based on the current user feedback received from the user interaction module and the historical data retrieved from the long-term memory module, and output the optimized target prompt words to the long-term memory module for storage. The long-term memory module is used to store the target prompt words, user feedback and document content, and to provide corresponding historical data support to the document generation module, the template and prompt word initialization module and the self-evolution module.
[0013] The self-evolution module includes an information input unit, an intelligent reasoning unit, and an output adaptation unit. The information input unit is connected to the user interaction module and the long-term memory module, respectively. The intelligent reasoning unit is connected to the information input unit, and the output adaptation unit is connected to the intelligent reasoning unit and the long-term memory module, respectively. The information input unit is used to receive real-time feedback information and historical data; The intelligent reasoning unit is used to drive the large language model to analyze and reason about the received information based on preset guiding prompts to generate optimized target prompts. The output adaptation unit is used to verify the generated optimized target prompt words and output the verified optimized target prompt words to the long-term memory module.
[0014] This invention discloses a document generation method and system based on a self-evolving intelligent agent. It constructs six modules: data acquisition and processing, template and prompt word initialization, document generation, user interaction, self-evolution, and long-term memory, forming a closed-loop process of "data acquisition - prompt word optimization - document generation - user feedback - iterative learning." The system first standardizes multi-source data, combines initial prompt words and templates to drive a large language model to generate documents, then obtains feedback through the user interaction module, and the self-evolution module dynamically optimizes prompt words based on real-time feedback and historical data. Finally, the long-term memory module enables user preference storage and version tracking. This effectively overcomes the shortcomings of existing technologies, such as insufficient personalized adaptation and lack of continuous evolution capabilities, achieving autonomous and continuous optimization of the document generation process, significantly improving the matching degree between output content and user needs, and reducing manual modification costs. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0016] Figure 1 This is a flowchart of the steps of the document generation method based on a self-evolving intelligent agent according to the first embodiment of the present invention.
[0017] Figure 2 This is a principle block diagram of the document generation system based on a self-evolving intelligent agent according to the second embodiment of the present invention.
[0018] Figure 3 This is a flowchart of a document generation system based on a self-evolving intelligent agent according to the second embodiment of the present invention.
[0019] In the diagram: 201-Data acquisition and processing module, 202-Template and prompt word initialization module, 203-Document generation module, 204-User interaction module, 205-Self-evolution module, 206-Long-term memory module, 207-Information input unit, 208-Intelligent reasoning unit, 209-Output adaptation unit. Detailed Implementation
[0020] The embodiments of the present invention are described in detail below. Examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, but should not be construed as limiting the present invention.
[0021] The first embodiment of this application is as follows: Please see Figure 1 This invention provides a document generation method based on a self-evolving intelligent agent, comprising the following steps: S1: Collects and processes multi-source data through data acquisition and processing module 201, and outputs standardized data; Specifically, the data sources for the data acquisition and processing module 201 include various structured and unstructured data obtained from queries within the enterprise's internal systems. Structured data includes standardized data obtained from databases and other software queries, such as verified financial statement data. Unstructured data includes images, scanned PDFs, conversations, or meeting recordings, etc.
[0022] Considering that the current document generation system requires structured plain text data, different data processing methods are adopted for different data formats. Structured data is directly parsed using code. For images and PDF scans, a multimodal large model or an OCR small model is used for text extraction, converting them into plain text. Then, a large model combined with prompts is used to extract key information, such as name, gender, home address, and marital status. For conversation or meeting recordings, a speech recognition model is first used to convert them into plain text. Then, a large model combined with prompts is used to extract key information, such as debt status, property information, and company operating status. All collected information is organized into structured data as the data source for document generation.
[0023] S2: Obtain the initial prompts and document templates corresponding to the business scenario through the template and prompt word initialization module 202; Specifically, the template and prompt initialization module 202 is based on a prompt template engine and has built-in document templates and prompt templates for various scenarios, such as a prompt library for due diligence report generation scenarios (including risk assessment scripts, due diligence suggestion frameworks, etc.), which supports variable substitution and logic nesting.
[0024] The preset prompt word template uses a prompt word enhancement strategy and adopts a three-part prompt structure of "system command + scene parameters + example guidance". The system command defines the overall requirements and constraints for document generation, the scene parameters dynamically call the structured information obtained by the data acquisition and processing module 201, and the example guidance is generated based on historical high-quality report fragments from the long-term memory module 206.
[0025] S3: The document generation module 203 generates document content by calling the large language model based on the standardized data, target prompt words, and the document template. Specifically, the document generation module 203, as the action unit of the self-evolving intelligent agent, primarily functions to generate high-quality, interpretable document content that conforms to the business context by calling a large language model based on structured business data, prompts optimized by user interaction, and preset document templates. This module not only undertakes text generation tasks but also integrates key capabilities such as model scheduling, request optimization, and source tracing of generated content, demonstrating a high degree of professionalism and technological advancement.
[0026] S31. Regarding large model selection and deployment strategies, this module supports a flexible model access architecture, compatible with mainstream open-source and closed-source large language models (such as the Qwen series). Depending on the enterprise's security strategy and performance requirements, it can choose between local private deployment or secure API gateway calls. Local deployment ensures sensitive business data remains within the domain, meeting compliance requirements in heavily regulated industries such as finance and law. The API call mode, through dynamic load balancing and asynchronous queuing mechanisms, effectively handles high-concurrency document generation requests, significantly reducing end-to-end response latency.
[0027] S32. To improve the accuracy and business adaptability of generated content, this module adopts a three-pronged generation control mechanism of "data-prompt words-template". After business data is standardized by the data acquisition and processing module 201, it is injected into the context of prompt words in the form of structured parameters to ensure that the model understands key facts. At the same time, the document template defines the output format, chapter structure and industry terminology standards, guiding the model to generate a document structure that conforms to professional standards. This mechanism effectively avoids the "illusion" problem of general large models and significantly improves the factual consistency and business logic rigor of the generated content.
[0028] S33. Introduce a content source tracing mechanism. During each document generation process, the system automatically records the structured data source used, prompt word version number, template identifier, type of large model called, and generation timestamp, and binds and stores the above metadata with the generated text. Users can trace the data source and generation basis of any paragraph or conclusion through the interactive interface, enhancing the auditability and credibility of the document and meeting the requirements of internal control and external supervision. It should be noted that the essence of the text source tracing mechanism in the Retrieval-Augmented Generation (RAG) system is "source citation," emphasizing external evidence support, and its implementation mechanism is vector retrieval + similar fragment citation + citation tagging. The essence of the source tracing in this module is "generation basis tracking," emphasizing the consistency of internal data and strategies, and its implementation mechanism is prompt word injection + metadata binding + version control.
[0029] S4: Display the document content to the user through the user interaction module 204, and receive user-submitted comments or suggestions for modifying prompts; Specifically, the user interaction module 204, acting as the perception unit of the self-evolving intelligent agent, provides a visual human-computer interaction interface for users, supporting document viewing and evaluation functions. The interface includes a report preview window, an evaluation input area, and a version comparison tool. Users can evaluate the report based on dimensions such as completeness, relevance of focus, and writing style, and submit specific suggestions for modifying prompts (such as "add analysis of related enterprise equity structure" or "simplify basic information description"). This module is a key entry point for collecting human feedback, providing input signals to the self-evolving module 205.
[0030] S5: Based on the current user feedback and the historical data stored in the long-term memory module 206, the self-evolution module 205 generates an optimized target prompt word and stores it in the long-term memory module 206. Specifically, the self-evolution module 205, as the planning unit of the self-evolutionary intelligent agent, bears the crucial responsibility of continuously iterating and transforming human feedback into system capabilities. Its core value lies in overcoming the technical bottlenecks of fixed prompts and monotonous output styles in traditional document generation systems. By constructing a closed-loop mechanism of "feedback-analysis-optimization-iteration," it enables the "document generation prompts" (hereinafter referred to as "target prompts") to continuously adapt to the professional preferences and business needs of different industries and users, ultimately achieving the autonomous evolution of document generation capabilities. This module optimizes guidance strategies through a pre-built large language model, integrating multi-dimensional contextual information and historical experience data to achieve intelligent and precise iteration of target prompts. It is a key carrier for the system to embody the core characteristic of a "self-evolutionary intelligent agent based on human feedback."
[0031] The self-evolution module 205 adopts a "three-level progressive" logical architecture to achieve full-process control from information input to optimized output. It is divided into information input, intelligent reasoning, and output adaptation. The specific steps of S5 include: S51. The information input module contains two core data channels: one is the "real-time feedback channel," which receives raw feedback information from the user interaction module 204, such as evaluations of the current document or optimization directions for target prompt words; the other is the "historical data channel," which calls the historical database of the long-term memory module 206 through the API interface, filters the most relevant historical data according to the two-dimensional index of "user_id-prompt word version," including the content of historical prompt word versions, corresponding feedback details, etc., and removes invalid and redundant information through a data deduplication algorithm. After processing, the two types of data form a unified "iterative information data package," which contains three main categories of content: current user feedback, current prompt word, and historical reference set.
[0032] S52. The core mechanism of intelligent reasoning is to construct the reasoning logic of a large language model through guided prompts, achieving precise iteration of target prompts. Guided prompts adopt a three-part structure: "target constraint - information guidance - format specification." The target constraint section clearly states that "the generated new prompts need to improve the relevance and professionalism of document generation, adapting to the current user's writing habits and preferences." The information guidance section clearly lists the full amount of data to be referenced during iteration (i.e., the iterative information data package output by the information input module) and defines data priorities (current feedback > current prompt > this user's historical data > similar user cases). The format specification section clearly states that new prompts must include four key elements: "business scenario definition, data calling rules, output structure requirements, and professional terminology specifications." During the reasoning process, the large language model first identifies core optimization needs based on feedback information, then extracts effective iterative experience by comparing the differences between the current prompt and historical prompts (e.g., if a user has requested to strengthen "cash flow analysis" three times, it is set as a fixed optimization direction), ultimately generating new target prompts that integrate real-time needs and historical experience. This process realizes the mapping transformation of "feedback signal - iterative strategy - target prompt output". In essence, it transforms human feedback into a "gradient signal" for target prompt optimization by guiding prompts, thus constructing a cognitive evolution closed loop that does not require parameter updates.
[0033] S53. The output adaptation module verifies the validity and adapts the format of the newly generated target prompts to ensure they can directly drive the document generation module 203. The verification process includes two core checks: first, a "logical consistency check," which uses a rule engine to determine if the optimization direction of the new target prompts matches user feedback, preventing deviations from requirements; second, a "format compliance check," confirming that the new target prompts conform to the input specifications of the document generation module 203, including necessary template association identifiers and data call instructions; and third, a "manual check and confirmation," allowing users to modify and save the generated new target prompts. After successful verification, the new target prompts are synchronized to the document generation module 203 to initiate a new round of document generation. Simultaneously, the target prompts and their corresponding feedback information are encapsulated as "iteration records" and pushed in real-time to the long-term memory module 206, providing data support for subsequent iterations.
[0034] S6: Return to step S3, regenerate the document content based on the optimized target prompt words, and repeat steps S4 to S6 until the user confirms that the document content meets the requirements. S7: The target prompts, user feedback, and final document content of this process are stored in the long-term memory module 206.
[0035] Specifically, the long-term memory module 206 serves as the storage unit of the self-evolving intelligent agent, aiming to construct an intelligent memory system with personalized user perception, historical experience accumulation, and continuous optimization capabilities. This module utilizes a highly secure non-relational database (MongoDB) to achieve structured storage, efficient retrieval, and version management of multi-dimensional interactive data, ensuring that the system continuously accumulates and leverages historical experience to drive the adaptive evolution of prompt words while protecting data privacy. The specific steps in S7 include: S71, Long-Term Memory Module 206 uses the user's unique identifier (user_id) as the index granularity to isolate and store key data generated by each user during the document generation process. The stored data includes, but is not limited to: prompt content for each iteration, corresponding user feedback (such as user ratings, modification suggestions, confirmation status, etc.), and the final document content generated by the large language model. It should be noted that, to strictly comply with data compliance and privacy protection requirements, the system does not store any original sensitive business data related to the applicant, such as ID card numbers, account information, transaction records, etc., but only retains de-identified and structured prompts, feedback semantic features, and report generation strategy metadata, fundamentally avoiding the risk of information leakage.
[0036] S72. In terms of architecture design, this module encapsulates each interaction loop as a timestamped versioned document, naturally supporting the traceability and comparability of the prompt word evolution path. Simultaneously, the system provides a visual analysis interface, allowing users to intuitively view the historical evolution trajectory of their personal prompt words, including version difference comparisons and feedback trend changes, thereby improving the transparency and controllability of human-machine collaboration.
[0037] S73 and the long-term memory module 206 not only serve the dynamic optimization of prompt words in real-time interactive scenarios, but also support an offline batch learning mechanism. The system automatically triggers a global prompt word aggregation and update task weekly: based on historical feedback data from all users, a weighted fusion and anomaly filtering strategy is used to extract prompt word patterns with universal optimization value and generate enterprise-level recommendation templates. This mechanism preserves the personalized preferences of individual users while achieving collaborative evolution of collective intelligence, significantly improving the system's generalization ability and adaptability across user and business scenarios.
[0038] In summary, the long-term memory module 206 constructs a memory hub that combines privacy compliance, cognitive continuity, and advanced strategies through a five-dimensional architecture of "personalized storage + security isolation + version evolution + visual traceability + batch collaborative optimization," providing a solid data foundation and evolutionary driving force for the "document generation system based on self-evolving intelligent agents" proposed in this invention.
[0039] In this system, the self-evolving agent is collaboratively constructed from the aforementioned six modules. Each module is a functional component of the self-evolving agent. Specifically: the data acquisition and processing module serves as the external perception unit of the self-evolving agent, enabling the acquisition, processing, and standardization of multi-source business data to provide basic information input for the agent; the template and prompt word initialization module serves as the decision initialization unit of the self-evolving agent, providing the agent with initial decision-making basis (initial prompt words + ...) that matches the business scenario. The document generation module is the action execution unit of the self-evolving intelligent agent, driving the large language model to complete the core action of document generation based on the agent's decision instructions (target prompt words); the user interaction module is the feedback perception unit of the self-evolving intelligent agent, realizing the accurate collection and transmission of human feedback information, providing a basis for the iterative optimization of the agent; the self-evolution module is the core decision-making and iterative optimization unit of the self-evolving intelligent agent, undertaking the core functions of feedback analysis, requirement analysis, and decision optimization, which is the key to realizing the self-evolution of the agent; the long-term memory module is the memory center of the self-evolving intelligent agent, undertaking the functions of historical data storage, evolutionary experience accumulation, and data traceability; each module realizes bidirectional interaction of instructions and data through preset interfaces and data flow protocols, forming a complete self-evolutionary closed loop of "perception-decision-action-feedback-optimization-memory", making this system a dedicated self-evolving intelligent agent for document generation with autonomous evolution capabilities.
[0040] The second embodiment of this application is as follows: Based on the first embodiment, please refer to Figure 2 and Figure 3 The document generation system based on self-evolving intelligent agents in this embodiment includes a data acquisition and processing module 201, a template and prompt word initialization module 202, a document generation module 203, a user interaction module 204, a self-evolution module 205, and a long-term memory module 206. The self-evolution module 205 includes an information input unit 207, an intelligent reasoning unit 208, and an output adaptation unit 209.
[0041] In this specific embodiment, the data acquisition and processing module 201 is connected to the template and prompt word initialization module 202 and the long-term memory module 206, respectively; the template and prompt word initialization module 202 is connected to the data acquisition and processing module 201, the document generation module 203, and the long-term memory module 206, respectively; the document generation module 203 is connected to the template and prompt word initialization module 202, the user interaction module 204, and the long-term memory module 206, respectively; the user interaction module 204 is connected to the document generation module 203 and the self-evolution module 205, respectively; the self-evolution module 205 is connected to the user interaction module 204 and the long-term memory module 206, respectively; and the long-term memory module 206 is connected to the data acquisition and processing module 201, the document generation module 203, the template and prompt word initialization module 202, and the self-evolution module 205, respectively. The data acquisition and processing module 201 is used to acquire and process multi-source data and output standardized data; The template and prompt initialization module 202 is used to receive the standardized data and provide initial prompts and document templates; The document generation module 203 is used to generate document content by calling a large language model based on the standardized data, the target prompt words obtained from the long-term memory module 206 and the document template. The user interaction module 204 is used to display the document content to the user and receive user-submitted comments or suggestions for modifying prompts. The self-evolution module 205 is used to generate optimized target prompt words based on the current user feedback received from the user interaction module 204 and the historical data retrieved from the long-term memory module 206, and output the optimized target prompt words to the long-term memory module 206 for storage. The long-term memory module 206 is used to store the target prompt words, user feedback and document content, and to provide corresponding historical data support to the document generation module 203, the template and prompt word initialization module 202 and the self-evolution module 205.
[0042] The information input unit 207 is connected to the user interaction module 204 and the long-term memory module 206 respectively, the intelligent reasoning unit 208 is connected to the information input unit 207, and the output adaptation unit 209 is connected to the intelligent reasoning unit 208 and the long-term memory module 206 respectively. The information input unit 207 is used to receive real-time feedback information and historical data; The intelligent reasoning unit 208 is used to drive the large language model to analyze and reason about the received information based on preset guiding prompt words in order to generate optimized target prompt words. The output adaptation unit 209 is used to verify the generated optimized target prompt words and output the verified optimized target prompt words to the long-term memory module 206.
[0043] The document generation system based on a self-evolving intelligent agent according to this embodiment includes a data acquisition and processing module 201, a template and prompt word initialization module 202, a document generation module 203, a user interaction module 204, a self-evolution module 205, and a long-term memory module 206. The specific contents of each module are as follows: Data acquisition and processing module 201: The data sources for the data acquisition and processing module 201 include various structured and unstructured data obtained from queries within the enterprise's internal systems. Structured data includes standardized data obtained from databases and other software queries, such as verified financial statement data. Unstructured data includes images, scanned PDFs, conversations, or meeting recordings, etc.
[0044] Considering that the current document generation system requires structured plain text data, different data processing methods are adopted for different data formats. Structured data is directly parsed using code. For images and PDF scans, a multimodal large model or an OCR small model is used for text extraction, converting them into plain text. Then, a large model combined with prompts is used to extract key information, such as name, gender, home address, and marital status. For conversation or meeting recordings, a speech recognition model is first used to convert them into plain text. Then, a large model combined with prompts is used to extract key information, such as debt status, property information, and company operating status. All collected information is organized into structured data as the data source for document generation.
[0045] Template and prompt initialization module 202: The template and prompt initialization module 202 is based on the prompt template engine and has built-in document templates and prompt templates for various scenarios, such as a prompt library for due diligence report generation scenarios (including risk assessment scripts, due diligence suggestion frameworks, etc.), and supports variable substitution and logic nesting.
[0046] The preset prompt word template uses a prompt word enhancement strategy and adopts a three-part prompt structure of "system command + scene parameters + example guidance". The system command defines the overall requirements and constraints for document generation, the scene parameters dynamically call the structured information obtained by the data acquisition and processing module 201, and the example guidance is generated based on historical high-quality report fragments from the long-term memory module 206.
[0047] Document generation module 203: The document generation module 203, as the action unit of the self-evolving intelligent agent, primarily functions to generate high-quality, interpretable, and context-appropriate document content based on structured business data, user-interaction-optimized prompts, and preset document templates, by calling a large language model. This module not only undertakes text generation tasks but also integrates key capabilities such as model scheduling, request optimization, and content tracing, demonstrating a high degree of professionalism and technological advancement.
[0048] Firstly, regarding large model selection and deployment strategies, this module supports a flexible model access architecture, compatible with mainstream open-source and closed-source large language models (such as the Qwen series). Depending on the enterprise's security strategy and performance requirements, it can choose between local private deployment or secure API gateway calls. Local deployment ensures sensitive business data remains within the domain, meeting compliance requirements in heavily regulated industries such as finance and law. The API call mode, through dynamic load balancing and asynchronous queuing mechanisms, effectively handles high-concurrency document generation requests, significantly reducing end-to-end response latency.
[0049] Secondly, to improve the accuracy and business adaptability of the generated content, this module adopts a three-pronged generation control mechanism of "data-prompt words-templates". After being standardized by the data acquisition and processing module 201, structured business data is injected into the context of prompt words in the form of structured parameters, ensuring that the model understands key facts. Simultaneously, the document template defines the output format, chapter structure, and industry terminology standards, guiding the model to generate document structures that conform to professional standards. This mechanism effectively avoids the "illusion" problem of generic large models and significantly improves the factual consistency and business logic rigor of the generated content.
[0050] Furthermore, this module introduces a content source tracing mechanism. During each document generation process, the system automatically records the structured data source used, prompt word version number, template identifier, type of large model called, and generation timestamp, and binds and stores this metadata with the generated text. Users can trace the data source and generation basis of any paragraph or conclusion through the interactive interface, enhancing the auditability and credibility of the document and meeting the requirements of internal control and external supervision. It is important to note that the essence of the text source tracing mechanism in the Retrieval-Augmented Generation (RAG) system is "source citation," emphasizing external evidence support; its implementation mechanism is vector retrieval + similar fragment citation + citation tagging. The essence of source tracing in this module is "generation basis tracking," emphasizing the consistency of internal data and strategies; its implementation mechanism is prompt word injection + metadata binding + version control.
[0051] In summary, the document generation module 203 not only achieves efficient, accurate, and interpretable intelligent document output, but also supports the stable, secure, and scalable application of the system as a self-evolving intelligent agent in real enterprise environments through an advanced model scheduling architecture, generation traceability mechanism, and high-concurrency optimization strategy, laying a high-quality output foundation for subsequent continuous evolution based on human feedback.
[0052] User interaction module 204: User interaction module 204, acting as the perception unit of the self-evolving intelligent agent, provides a visual human-computer interaction interface for users. It supports document viewing and evaluation functions, and the interface includes a report preview window, an evaluation input area, and a version comparison tool. Users can evaluate the report based on dimensions such as completeness, relevance of focus, and writing style, and submit specific suggestions for modification (e.g., "add analysis of related enterprise equity structure" or "simplify basic information description"). This module is a key entry point for collecting human feedback, providing input signals to the self-evolving module 205.
[0053] Self-evolution module 205: The self-evolving module 205, as the planning unit of the self-evolving intelligent agent, bears the crucial responsibility of continuously iterating and transforming human feedback into system capabilities. Its core value lies in overcoming the technical bottlenecks of fixed prompts and monotonous output styles in traditional document generation systems. By constructing a closed-loop mechanism of "feedback-analysis-optimization-iteration," it enables "document generation prompts" (hereinafter referred to as "target prompts") to continuously adapt to the professional preferences and business needs of different industries and users, ultimately achieving the autonomous evolution of document generation capabilities. This module optimizes guidance strategies through a pre-built large language model, integrating multi-dimensional contextual information and historical experience data to achieve intelligent and precise iteration of target prompts. It is a key carrier embodying the core characteristic of the system as a "self-evolving intelligent agent based on human feedback."
[0054] The self-evolution module 205 adopts a "three-level progressive" logical architecture to achieve full-process control from information input to optimized output. It is divided into information input, intelligent reasoning, and output adaptation. The functions of each module are as follows: Information input unit 207 contains two core data channels: one is the "real-time feedback channel," which receives raw feedback information from the user interaction module 204, such as evaluations of the current document or optimization directions for target prompt words; the other is the "historical data channel," which calls the historical database of the long-term memory module 206 through an API interface, filters out the most relevant historical data according to the two-dimensional index of "user_id-prompt word version," including the content of historical prompt word versions, corresponding feedback details, etc., and removes invalid and redundant information through a data deduplication algorithm. After processing, the two types of data form a unified "iterative information data package," which contains three main categories of content: current user feedback, current prompt word, and historical reference set.
[0055] Intelligent Reasoning Unit 208: Its core mechanism is to construct the reasoning logic of a large language model through guided prompts, achieving precise iteration of target prompts. Guided prompts adopt a three-part structure: "target constraint - information guidance - format specification." The target constraint section clearly states that "the generated new prompts need to improve the targeting and professionalism of document generation, adapting to the current user's writing habits and preferences." The information guidance section clearly lists the full amount of data to be referenced during iteration (i.e., the iterative information data package output by the information input module) and defines data priorities (current feedback > current prompt > this user's historical data > similar user cases). The format specification section clarifies that new prompts must include four key elements: "business scenario definition, data calling rules, output structure requirements, and professional terminology specifications." During the reasoning process, the large language model first identifies core optimization needs based on feedback information, then extracts effective iterative experience by comparing the differences between the current prompt and historical prompts (e.g., if a user has requested to strengthen "cash flow analysis" three times, it is set as a fixed optimization direction), ultimately generating new target prompts that integrate real-time needs and historical experience. This process realizes the mapping transformation of "feedback signal - iterative strategy - target prompt output". In essence, it transforms human feedback into a "gradient signal" for target prompt optimization by guiding prompts, thus constructing a cognitive evolution closed loop that does not require parameter updates.
[0056] Output adaptation unit 209: Performs validity verification and format adaptation on newly generated target prompts to ensure they can directly drive the document generation module 203. The verification process includes two core checks: first, a "logical consistency check," which uses a rule engine to determine whether the optimization direction of the new target prompt matches user feedback, avoiding deviations from requirements; second, a "format compliance check," confirming that the new target prompt conforms to the input specifications of the document generation module 203, including necessary template association identifiers and data call instructions; and third, a "manual check and confirmation," allowing users to modify, edit, and save the generated new target prompts. After successful verification, the new target prompt will be synchronized to the document generation module 203 to initiate a new round of document generation; simultaneously, the target prompt and its corresponding feedback information will be encapsulated as an "iteration record" and pushed in real-time to the long-term memory module 206 to provide data support for subsequent iterations.
[0057] Long-term memory module 206: The long-term memory module 206, serving as the storage unit for the self-evolving intelligent agent, aims to construct an intelligent memory system with personalized user perception, historical experience accumulation, and continuous optimization capabilities. This module utilizes a highly secure non-relational database (MongoDB) to achieve structured storage, efficient retrieval, and version management of multi-dimensional interactive data, ensuring that the system continuously accumulates and leverages historical experience to drive the adaptive evolution of prompt words while protecting data privacy.
[0058] Specifically, the long-term memory module 206 uses the user's unique identifier (user_id) as the index granularity to isolate and store key data generated by each user during the document generation process. The stored data includes, but is not limited to: prompt content for each iteration, corresponding user feedback (such as user ratings, modification suggestions, confirmation status, etc.), and the final document content generated by the large language model. It should be noted that, to strictly comply with data compliance and privacy protection requirements, the system does not store any original sensitive business data related to the applicant, such as ID card numbers, account information, transaction records, etc., but only retains de-identified and structured prompts, feedback semantic features, and report generation strategy metadata, fundamentally avoiding the risk of information leakage.
[0059] In terms of architecture, this module encapsulates each interaction loop as a timestamped versioned document, naturally supporting the traceability and comparability of the prompt word evolution path. Simultaneously, the system provides a visual analysis interface, allowing users to intuitively view the historical evolution trajectory of their personal prompt words, including version difference comparisons and feedback trend changes, thereby improving the transparency and controllability of human-machine collaboration.
[0060] Furthermore, the long-term memory module 206 not only serves the dynamic optimization of prompt words in real-time interactive scenarios but also supports an offline batch learning mechanism. The system automatically triggers a global prompt word aggregation and update task weekly: based on historical feedback data from all users, it employs weighted fusion and anomaly filtering strategies to extract prompt word patterns with universal optimization value and generate enterprise-level recommendation templates. This mechanism preserves the personalized preferences of individual users while achieving collaborative evolution through collective intelligence, significantly improving the system's generalization ability and adaptability across user and business scenarios.
[0061] In summary, the long-term memory module 206 constructs a memory hub that combines privacy compliance, cognitive continuity, and advanced strategies through a five-dimensional architecture of "personalized storage + security isolation + version evolution + visual traceability + batch collaborative optimization," providing a solid data foundation and evolutionary driving force for the "document generation system based on self-evolving intelligent agents" proposed in this invention.
[0062] Compared to existing document generation technologies, this invention boasts superior personalized adaptation capabilities: It constructs user preference data through a long-term memory module 206, and combines this with a self-evolution module 205 to optimize target prompts in a targeted manner. This allows the system to accurately match the writing habits of different users and the writing standards of different industries, outputting documents that meet personalized needs and reducing manual modification costs. Its self-evolution capability continuously upgrades: Based on a closed-loop logic of "user feedback - target prompt optimization - document content iteration," the system can self-upgrade without developer intervention. As usage frequency increases, the accuracy of target prompts continuously improves, gradually optimizing document generation quality and efficiency.
[0063] The above-disclosed embodiments are merely one or more preferred embodiments of this application and should not be construed as limiting the scope of this application. Those skilled in the art can understand that all or part of the processes for implementing the above embodiments and equivalent changes made in accordance with the claims of this application still fall within the scope of this application.
Claims
1. A document generation method based on self-evolving agents, characterized in that, The method comprises the following steps: S1: collecting and processing multi-source data through a data collection and processing module to output standardized data; S2: obtaining initial prompt words and document templates corresponding to a business scenario through a template and prompt word initialization module; S3: generating document content based on the standardized data, target prompt words, and the document templates through a document generation module; S4: showing the document content to a user through a user interaction module and receiving evaluation or prompt word modification suggestions submitted by the user; S5: generating optimized target prompt words based on the user feedback and historical data stored in a long-term memory module through a self-evolution module, and storing the optimized target prompt words in the long-term memory module; S6: returning to step S3 to regenerate document content based on the optimized target prompt words, and repeatedly performing steps S4 to S6 until the user confirms that the document content meets the requirements; S7: storing the target prompt words, user feedback, and final document content in the long-term memory module.
2. The self-evolving agent based document generation method as claimed in claim 1, wherein, The data collection and processing module collects and processes multi-source data to output standardized data, specifically including: collecting structured data and unstructured data; parsing the structured data; converting the unstructured data into text using a character recognition model or a speech recognition model, and extracting key information from the text using a large language model; organizing the parsed structured data and extracted key information into structured data as a data source for document generation.
3. The self-evolving agent based document generation method as claimed in claim 2, wherein, The template and prompt word initialization module obtains initial prompt words and document templates corresponding to a business scenario, specifically including: The initial prompt words adopt a prompt structure of system instructions + scene parameters + example guidance, wherein the scene parameters are used to call the standardized data, and the example guidance is generated based on historical document content stored in the long-term memory module.
4. The self-evolving agent based document generation method as claimed in claim 3, wherein, The document generation module generates document content based on the standardized data, target prompt words, and the document templates by calling a large language model, specifically including: a large language model deployed locally or called through a secure application programming interface; injecting the standardized data into the context of the target prompt words, and combining the structure and specifications of the document templates to guide the large language model to generate document content; recording the data sources, prompt word versions, template identifiers, and model information used when generating the document content, and storing the information and the generated document content.
5. The self-evolving agent based document generation method as claimed in claim 4, wherein, The user interaction module shows the document content to the user and receives evaluation or prompt word modification suggestions submitted by the user, specifically including: The user interaction module provides an interface including document preview, evaluation input, and version comparison functions to receive multi-dimensional evaluation of the document content and specific prompt word modification suggestions from the user.
6. The self-evolving agent based document generation method as claimed in claim 5, wherein, The self-evolution module generates optimized target prompt words based on the user feedback and historical data stored in the long-term memory module, and stores the optimized target prompt words in the long-term memory module, specifically including: obtaining real-time feedback information from the user interaction module and historical data associated with the current user and the prompt version from the long-term memory module to form an iterative information data package; based on the preset guiding prompt word, driving the large language model to analyze and reason the iterative information data package to generate the optimized target prompt word; performing logical consistency and format compliance verification on the generated optimized target prompt word, and if the verification is passed, synchronizing it to the document generation module and storing this iteration record to the long-term memory module.
7. A document generation system based on self-evolution agent, for implementing the method of claim 1, characterized in that, comprising a data acquisition and processing module, a template and prompt word initialization module, a document generation module, a user interaction module, a self-evolution module and a long-term memory module, the data acquisition and processing module is connected with the template and prompt word initialization module and the long-term memory module respectively; the template and prompt word initialization module is connected with the data acquisition and processing module, the document generation module and the long-term memory module respectively; the document generation module is connected with the template and prompt word initialization module, the user interaction module and the long-term memory module respectively; the user interaction module is connected with the document generation module and the self-evolution module; the self-evolution module is connected with the user interaction module and the long-term memory module respectively; the long-term memory module is connected with the data acquisition and processing module, the document generation module, the template and prompt word initialization module and the self-evolution module respectively; the data acquisition and processing module is used for collecting and processing multi-source data and outputting standardized data; the template and prompt word initialization module is used for receiving the standardized data and providing initial prompt words and document templates; the document generation module is used for calling a large language model to generate document content based on the standardized data, target prompt words obtained from the long-term memory module and document templates; the user interaction module is used for showing the document content to the user and receiving the user's submitted evaluation or prompt word modification suggestion; the self-evolution module is used for generating an optimized target prompt word based on the user feedback received from the user interaction module and historical data obtained from the long-term memory module, and outputting the optimized target prompt word to the long-term memory module for storage; the long-term memory module is used for storing the target prompt word, user feedback and document content, and providing corresponding historical data support to the document generation module, the template and prompt word initialization module and the self-evolution module.
8. The document generation system based on self-evolution agent of claim 7, characterized in that, The self-evolution module comprises an information input unit, an intelligent reasoning unit and an output adaptation unit, the information input unit is connected with the user interaction module and the long-term memory module respectively, the intelligent reasoning unit is connected with the information input unit, and the output adaptation unit is connected with the intelligent reasoning unit and the long-term memory module respectively; The information input unit is configured to receive real-time feedback information and historical data; The intelligent reasoning unit is configured to drive a large language model to analyze and reason the received information based on a preset guide prompt word to generate an optimized target prompt word; The output adaptation unit is configured to verify the generated optimized target prompt word and output the optimized target prompt word that passes the verification to the long-term memory module.
Citation Information
Patent Citations
Dynamic interactive document generation method and device based on generative AI, computer equipment and computer readable storage medium
CN121072503A
Engineering document index consistency proofreading method and system based on multi-modal large model
CN121145835A
Cue word generation method and system based on user habits and documents
CN121478946A