Method, device, equipment, medium and product for generating content based on index document
By acquiring the tag encoding and semantic element information of structured index documents and combining them with a large model to generate target content, the problem of inaccurate generation by large models in complex tasks is solved, achieving global cognition and accurate generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING XINYU YUELIAN TECHNOLOGY DEVELOPMENT CO LTD
- Filing Date
- 2026-02-13
- Publication Date
- 2026-06-05
AI Technical Summary
When faced with complex tasks or complex user needs, large models generate inaccurate target content based on user needs descriptions in natural language.
By acquiring structured indexed documents and utilizing a large model in conjunction with tag encoding and semantic element information to generate target content, the problem of insufficient global understanding of the system architecture by the large model is solved.
It achieves a large model's global understanding of the system architecture, generates accurate target content, and solves the problem of insufficient expression of traditional natural language instructions in complex tasks.
Smart Images

Figure CN122154697A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence technology and information processing technology, and in particular to a method, apparatus, device, medium and product for generating content based on indexed documents. Background Technology
[0002] With the rapid development of artificial intelligence technology, large-scale models have been widely applied in fields such as code generation, image creation, and document generation. By receiving user requests, large-scale models can generate target content corresponding to the user's needs.
[0003] In some technologies, after a user inputs a description of their needs, the large model directly generates the target content based on this natural language description. However, these technologies lack a holistic understanding of the system architecture when dealing with complex tasks or complex user needs, leading to inaccuracies in the generated target content.
[0004] Therefore, there is an urgent need for a solution that can enable large models to have a global understanding of the system architecture and accurately generate target content. Summary of the Invention
[0005] The content generation method, apparatus, device, medium, and product based on indexed documents provided in this application are used to achieve a large model's global understanding of the system architecture and accurately generate target content.
[0006] In a first aspect, embodiments of this application provide a content generation method based on indexed documents, including:
[0007] Retrieve the structured index document; wherein, the structured index document includes multiple index entries, each index entry includes tag encoding and semantic feature information; the tag encoding includes the encoding values of multiple tag dimensions, each tag dimension encoding value is used to indicate the attributes of the source content or target content in the tag dimension; the semantic feature information includes multiple semantic features, each semantic feature is used to indicate the semantic features of the source content or target content;
[0008] In response to user input commands, the system generates target content based on a large model and structured indexed documents; where user commands represent the relevant requirements for the target content to be generated.
[0009] In one possible implementation, in response to a user-inputted command, target content is generated based on a large model and structured indexed documents, including:
[0010] If the user instruction indicates a requirement for content reproduction, then based on the large model, the target content is generated according to the attributes of the source content in the tag dimension indicated by each index entry in the structured index document, as well as the semantic features of the source content; and / or,
[0011] If the user instruction indicates that the requirement for the target content to be generated is incremental development, then based on the large model, new index entries are generated according to the user instruction and the structured index document; based on the large model, the target content is generated according to the new index entries; and / or,
[0012] If the user instruction indicates that the relevant requirement for the target content to be generated is cross-domain migration, then based on the large model, the structured index document is converted according to the user instruction to obtain the target format structured index document; based on the large model, the target content is generated according to the target format structured index document.
[0013] In one possible implementation, if the user instruction indicates that the relevant requirements for the target content to be generated are for incremental development, the method further includes:
[0014] Based on the large model, modification suggestions are generated according to the structured index documents and the new index entries; the modification suggestions are the parts of the structured index documents that are affected by the new index entries.
[0015] In one possible implementation, the semantic element information in the structured index document is determined based on the domain of the source content corresponding to the structured index document;
[0016] When the domain of the source content is the code domain, the semantic elements in the semantic element information include: functional elements, related elements, interface elements, and descriptive elements;
[0017] When the source content is in the image domain, the semantic elements in the semantic element information include: subject elements, layout elements, aesthetic elements, symbolic elements, and output elements;
[0018] When the source content is in the medical field, the semantic elements in the semantic element information include: symptom elements, association elements, diagnostic elements, and treatment plan elements;
[0019] When the source content is in the legal field, the semantic elements in the semantic element information include: clause elements, citation elements, case law elements, and restriction elements.
[0020] In one possible implementation, when the source content is in the image domain, the target content is the image to be generated, and the large model is a multimodal image generation model.
[0021] Semantic elements in a structured index document are used to indicate at least one of the following: the main content, hierarchical layout, artistic style, symbolic meaning, and output specifications of the image to be generated.
[0022] In one possible implementation, when the domain of the source content is an image domain, the method further includes:
[0023] Obtain at least one shared constraint module; wherein, the shared constraint module is used to define attribute constraints that are commonly referenced by multiple index entries; the attribute constraints include at least one of role constraints, style constraints, and scene constraints;
[0024] Based on the large model, target content is generated from structured indexed documents, including:
[0025] Based on a multimodal image generation model, multiple images to be generated are generated according to each index entry in a structured index document and at least one shared constraint module. The images to be generated correspond to the index entries.
[0026] In one possible implementation, the method further includes:
[0027] The structured index document is used as the central control index document and input into the main intelligent agent; the main intelligent agent is used for task planning and sub-agent scheduling based on the central control index document.
[0028] In response to the main intelligent agent receiving the user task, the main intelligent agent determines the target sub-intelligent agent based on the sub-intelligent agent definition area in the central control index document; wherein, the sub-intelligent agent definition area includes index entries for indicating the professional domain, input and output specifications, calling interface and cooperation constraints of each sub-intelligent agent; the target sub-intelligent agent is the sub-intelligent agent that can solve the user task;
[0029] Based on the workflow configuration area in the central control index document, the main intelligent agent decomposes the user task into at least one subtask and determines the execution order and dependencies of each subtask. The workflow configuration area includes index entries for indicating task decomposition rules, execution order, branch conditions, state transitions, and exception handling.
[0030] Based on the tool registration area in the central control index document, the master agent determines the available tools and constraints of each sub-agent; the tool registration area includes index entries that indicate the functional description, parameter specifications, calling constraints and resource consumption of the available tools for each sub-agent.
[0031] The main intelligent agent schedules target sub-intelligent agents to execute sub-tasks, and performs message passing and state synchronization according to the communication protocol area in the central control index document; wherein, the communication protocol area includes index entries used to indicate semantic interaction protocols, state synchronization mechanisms, conflict resolution rules and permission inheritance relationships between intelligent agents;
[0032] The main agent receives the execution results from the target sub-agent and integrates them to obtain the final result corresponding to the user task.
[0033] In one possible implementation, the method further includes at least one of the following:
[0034] When a new sub-agent is added, an index entry corresponding to the new sub-agent is added to the sub-agent definition area in the central control index document;
[0035] When a new available tool is added, an index entry corresponding to the new available tool is added to the tool registration area in the central control index document;
[0036] When a workflow changes, the index entries corresponding to the changed workflow are updated in the workflow configuration area of the central control index document.
[0037] In one possible implementation, the method further includes:
[0038] Retrieve the source content corresponding to the structured indexed document;
[0039] Multiple training sample pairs are constructed based on the index entries in the structured index documents and the source content corresponding to the index entries;
[0040] Supervised fine-tuning training of a large model is performed based on multiple training sample pairs.
[0041] In one possible implementation, the multiple training sample pairs include forward training sample pairs and reverse training sample pairs.
[0042] In the forward training sample pairs, the index entries are used as training samples, and the source content corresponding to the index entries is used as the label value; in the reverse training sample pairs, the source content corresponding to the index entries is used as training samples, and the index entries are used as label values.
[0043] In one possible implementation, training sample pairs have weight values in the loss function, which indicate the contribution of the training samples to supervised fine-tuning of the large model. The weight values of the training sample pairs are positively correlated with the encoded values of the importance dimension in the label encoding of the index entries.
[0044] In one possible implementation, the method further includes:
[0045] Input the target content into the large model to generate inverted index entries;
[0046] A consistency score is calculated based on the inverted index entries and the index entries in the structured index documents; the consistency score is used to characterize the degree of consistency between the inverted index entries and the index entries in the structured index documents.
[0047] In one possible implementation, the method further includes:
[0048] Responding to user input of requirement descriptions, and based on a large model, generating structured indexed documents according to the requirement descriptions;
[0049] In response to user modifications to the structured index documents, target content is generated based on the modified structured index documents using a large model.
[0050] In one possible implementation, the method further includes:
[0051] Based on the requirements description, at least one version of the structured index document, and the target content, a planning-priority training sample is constructed. The planning-priority training sample is used for supervised fine-tuning training of the large model. The at least one version of the structured index document includes the structured index document generated based on the large model according to the requirements description, and / or the modified structured index document.
[0052] In one possible implementation, the structured index document also includes global constraint information; the global constraint information is used to ensure that the target content conforms to the specification constraints indicated by the global constraint information during the process of generating target content based on the large model and the structured index document.
[0053] Among them, the normative constraints include at least one of the following: technical specification constraints, style specification constraints, compatibility constraints, and security constraints.
[0054] In one possible implementation, the method further includes:
[0055] In response to sharing requests from other AI interaction objects, the structured index document is sent to the other AI interaction objects so that they can reuse the structured index document to generate the target content.
[0056] Secondly, embodiments of this application provide a content generation apparatus based on indexed documents, comprising:
[0057] The acquisition module is used to acquire structured index documents. The structured index documents include multiple index entries, each index entry includes tag encoding and semantic feature information. The tag encoding includes the encoding values of multiple tag dimensions, and the encoding values of each tag dimension are used to indicate the attributes of the source content or target content in the tag dimension. The semantic feature information includes multiple semantic features, each semantic feature is used to indicate the semantic features of the source content or target content.
[0058] The processing module is used to respond to user input commands and generate target content based on a large model and structured indexed documents; where user commands represent the relevant requirements for the target content to be generated.
[0059] In one possible implementation, in response to a user input command, based on a large model and structured indexed documents, target content is generated, and the processing module is used for:
[0060] If the user instruction indicates a requirement for content reproduction, then based on the large model, the target content is generated according to the attributes of the source content in the tag dimension indicated by each index entry in the structured index document, as well as the semantic features of the source content; and / or,
[0061] If the user instruction indicates that the requirement for the target content to be generated is incremental development, then based on the large model, new index entries are generated according to the user instruction and the structured index document; based on the large model, the target content is generated according to the new index entries; and / or,
[0062] If the user instruction indicates that the relevant requirement for the target content to be generated is cross-domain migration, then based on the large model, the structured index document is converted according to the user instruction to obtain the target format structured index document; based on the large model, the target content is generated according to the target format structured index document.
[0063] In one possible implementation, if the user instruction indicates that the requirement for the target content to be generated is incremental development, the processing module is further configured to:
[0064] Based on the large model, modification suggestions are generated according to the structured index documents and the new index entries; the modification suggestions are the parts of the structured index documents that are affected by the new index entries.
[0065] In one possible implementation, the semantic element information in the structured index document is determined based on the domain of the source content corresponding to the structured index document;
[0066] When the domain of the source content is the code domain, the semantic elements in the semantic element information include: functional elements, related elements, interface elements, and descriptive elements;
[0067] When the source content is in the image domain, the semantic elements in the semantic element information include: subject elements, layout elements, aesthetic elements, symbolic elements, and output elements;
[0068] When the source content is in the medical field, the semantic elements in the semantic element information include: symptom elements, association elements, diagnostic elements, and treatment plan elements;
[0069] When the source content is in the legal field, the semantic elements in the semantic element information include: clause elements, citation elements, case law elements, and restriction elements.
[0070] In one possible implementation, when the source content is in the image domain, the target content is the image to be generated, and the large model is a multimodal image generation model.
[0071] Semantic elements in a structured index document are used to indicate at least one of the following: the main content, hierarchical layout, artistic style, symbolic meaning, and output specifications of the image to be generated.
[0072] In one possible implementation, when the domain of the source content is an image domain, the acquisition module is further configured to acquire at least one shared constraint module; wherein, the shared constraint module is configured to define attribute constraints commonly referenced by multiple index entries; the attribute constraints include at least one of role constraints, style constraints, and scene constraints;
[0073] Based on the large model and structured indexed documents, target content is generated. The processing module is used for:
[0074] Based on a multimodal image generation model, multiple images to be generated are generated according to each index entry in a structured index document and at least one shared constraint module. The images to be generated correspond to the index entries.
[0075] In one possible implementation, the processing module is further configured to:
[0076] The structured index document is used as the central control index document and input into the main intelligent agent; the main intelligent agent is used for task planning and sub-agent scheduling based on the central control index document.
[0077] In response to the main intelligent agent receiving the user task, the main intelligent agent determines the target sub-intelligent agent based on the sub-intelligent agent definition area in the central control index document; wherein, the sub-intelligent agent definition area includes index entries for indicating the professional domain, input and output specifications, calling interface and cooperation constraints of each sub-intelligent agent; the target sub-intelligent agent is the sub-intelligent agent that can solve the user task;
[0078] Based on the workflow configuration area in the central control index document, the main intelligent agent decomposes the user task into at least one subtask and determines the execution order and dependencies of each subtask. The workflow configuration area includes index entries for indicating task decomposition rules, execution order, branch conditions, state transitions, and exception handling.
[0079] Based on the tool registration area in the central control index document, the master agent determines the available tools and constraints of each sub-agent; the tool registration area includes index entries that indicate the functional description, parameter specifications, calling constraints and resource consumption of the available tools for each sub-agent.
[0080] The main intelligent agent schedules target sub-intelligent agents to execute sub-tasks, and performs message passing and state synchronization according to the communication protocol area in the central control index document; wherein, the communication protocol area includes index entries used to indicate semantic interaction protocols, state synchronization mechanisms, conflict resolution rules and permission inheritance relationships between intelligent agents;
[0081] The main agent receives the execution results from the target sub-agent and integrates them to obtain the final result corresponding to the user task.
[0082] In one possible implementation, the processing module is also configured to perform at least one of the following:
[0083] When a new sub-agent is added, an index entry corresponding to the new sub-agent is added to the sub-agent definition area in the central control index document;
[0084] When a new available tool is added, an index entry corresponding to the new available tool is added to the tool registration area in the central control index document;
[0085] When a workflow changes, the index entries corresponding to the changed workflow are updated in the workflow configuration area of the central control index document.
[0086] In one possible implementation, the processing module is further configured to:
[0087] Retrieve the source content corresponding to the structured indexed document;
[0088] Multiple training sample pairs are constructed based on the index entries in the structured index documents and the source content corresponding to the index entries;
[0089] Supervised fine-tuning training of a large model is performed based on multiple training sample pairs.
[0090] In one possible implementation, the multiple training sample pairs include forward training sample pairs and reverse training sample pairs.
[0091] In the forward training sample pairs, the index entries are used as training samples, and the source content corresponding to the index entries is used as the label value; in the reverse training sample pairs, the source content corresponding to the index entries is used as training samples, and the index entries are used as label values.
[0092] In one possible implementation, training sample pairs have weight values in the loss function, which indicate the contribution of the training samples to supervised fine-tuning of the large model. The weight values of the training sample pairs are positively correlated with the encoded values of the importance dimension in the label encoding of the index entries.
[0093] In one possible implementation, the processing module is further configured to:
[0094] Input the target content into the large model to generate inverted index entries;
[0095] A consistency score is calculated based on the inverted index entries and the index entries in the structured index documents; the consistency score is used to characterize the degree of consistency between the inverted index entries and the index entries in the structured index documents.
[0096] In one possible implementation, the processing module is further configured to:
[0097] Responding to user input of requirement descriptions, and based on a large model, generating structured indexed documents according to the requirement descriptions;
[0098] In response to user modifications to the structured index documents, target content is generated based on the modified structured index documents using a large model.
[0099] In one possible implementation, the processing module is further configured to:
[0100] Based on the requirements description, at least one version of the structured index document, and the target content, a planning-priority training sample is constructed. The planning-priority training sample is used for supervised fine-tuning training of the large model. The at least one version of the structured index document includes the structured index document generated based on the large model according to the requirements description, and / or the modified structured index document.
[0101] In one possible implementation, the structured index document also includes global constraint information; the global constraint information is used to ensure that the target content conforms to the specification constraints indicated by the global constraint information during the process of generating target content based on the large model and the structured index document.
[0102] Among them, the normative constraints include at least one of the following: technical specification constraints, style specification constraints, compatibility constraints, and security constraints.
[0103] In one possible implementation, the processing module is further configured to:
[0104] In response to sharing requests from other AI interaction objects, the structured index document is sent to the other AI interaction objects so that they can reuse the structured index document to generate the target content.
[0105] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0106] The memory stores the instructions that the computer executes;
[0107] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0108] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0109] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0110] The content generation method, apparatus, device, medium, and product based on indexed documents provided in this application acquire a structured indexed document and, upon receiving a user's instruction, generate target content based on a large model using the structured indexed document. By combining the collaborative parsing of the indexed document and the large model, it solves the problem that traditional natural language instructions are insufficient for complex tasks, leading to inaccurate target content. The structured indexed document can fully and with high compression rate represent the attribute information and semantics of the source or target content through tag encoding and semantic elements. Based on the tag encoding and semantic elements in the structured indexed document, the large model can quickly understand the global architecture and global cognition of the source or target content, thereby generating accurate target content. Attached Figure Description
[0111] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0112] Figure 1 A flowchart illustrating the content generation method based on indexed documents provided in this application. Figure 1 ;
[0113] Figure 2 Examples of index entry formats from different fields;
[0114] Figure 3 This is a schematic diagram illustrating the process of generating target content by combining the shared constraint module;
[0115] Figure 4 A flowchart illustrating the content generation method based on indexed documents provided in this application. Figure 2 ;
[0116] Figure 5 This is a schematic diagram of the processing flow of an exemplary multi-agent system;
[0117] Figure 6 This is an example of an interaction signaling diagram within a multi-agent system;
[0118] Figure 7A flowchart illustrating the content generation method based on indexed documents provided in this application. Figure 3 ;
[0119] Figure 8 This is a schematic diagram illustrating an exemplary index evaluation process;
[0120] Figure 9 Schematic diagram of the content generation device based on indexed documents provided in this application Figure 1 ;
[0121] Figure 10 Schematic diagram of the content generation device based on indexed documents provided in this application Figure 2 ;
[0122] Figure 11 A schematic diagram of the structure of the electronic device provided in this application.
[0123] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0124] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0125] First, let me explain the terms used in this application:
[0126] Structured index documents are text-based structural information containing tag encodings and semantic elements, used to describe the global architecture of a content repository. Index documents are in plain text format without vector representations and are human-readable, editable, and version-controllable.
[0127] The tag encoding in the indexed document has multiple tag dimensions. This application embodiment does not limit the order of these tag dimensions. In practical applications, the order of the tag dimensions in the tag encoding is not limited to the order shown in the examples in this specification, and different orderings of dimensions do not affect the execution of the method provided in this application embodiment. Even if the tag encoding is presented as a single string in text representation, as long as the string contains multiple independently identifiable information dimensions, it can also serve as the tag encoding for multiple independent tag dimensions.
[0128] Index-driven generation refers to a method that uses structured indexed documents to guide a large model in generating target content. The large model can be a large language model or a multimodal image generation model.
[0129] Shared constraint module: This refers to the module that defines attribute constraints that are commonly referenced by multiple index entries, used to ensure the consistency of continuous content generation.
[0130] Central Control Index Document: This refers to a special index document used for the central control of a multi-agent system, containing structured information in six areas. A multi-agent system is a distributed system composed of multiple agents, capable of information exchange, task collaboration, and behavioral coordination to jointly complete tasks. An agent is a computational entity possessing relevant intelligent computing capabilities, capable of autonomously operating and completing specified tasks in a given scenario. Specifically, an agent can autonomously perceive its environment, make independent reasoning decisions, and execute targeted actions.
[0131] Against the backdrop of rapid development in artificial intelligence technology, large-scale models have been widely applied in various fields such as code generation, image creation, document generation, legal consultation, and medical diagnosis. For example, in software development scenarios, developers need to quickly generate code frameworks or specific functional modules based on requirements documents; in the design field, users may need to generate images that meet aesthetic requirements based on style descriptions; and in the medical field, doctors may need to generate diagnostic reports or treatment plans based on patient symptoms.
[0132] In some embodiments, users input their requirements in natural language, and the large model directly parses the user's input and generates the corresponding results. This process performs well for simple tasks, but when faced with complex tasks, user requirements often contain multi-dimensional constraints, which are difficult to express systematically in natural language.
[0133] Because large models generate target content directly based on user input, this may lead to inaccurate target content generation.
[0134] Taking software development as an example, users need to describe the performance, functionality, and attribute requirements of the code content using natural language, inputting this information into a large model to generate target code. Because the large model lacks a global understanding of the task structure, the generated target code may suffer from issues of accuracy, consistency, and scalability.
[0135] As can be seen from the above embodiments, generating target content directly based on user needs through a large model has the technical problem of inaccurate target content.
[0136] This application provides a content generation method based on indexed documents. By acquiring structured indexed documents and receiving user instructions, it generates target content based on a large model using these documents. By combining the collaborative parsing of the indexed documents and the large model, it addresses the problem of inaccurate target content generation caused by the inadequacy of traditional natural language instructions in complex tasks. The structured indexed documents can fully and with high compression rates represent the attributes of the source or target content through tag encoding and semantic elements. Based on the tag encoding and semantic elements in the structured indexed documents, the large model can quickly understand the global architecture and overall cognition of the source or target content, thereby generating accurate target content.
[0137] The technical solution of this application and how it solves the above-mentioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0138] In terms of content generation, large-scale models typically employ a single-stage generation approach from requirements to content, directly generating target content from natural language requirement descriptions. This approach is prone to issues such as inconsistent architecture, mismatched interfaces, and chaotic dependencies when dealing with complex multi-file systems.
[0139] Figure 1 A flowchart illustrating the content generation method based on indexed documents provided in this application. Figure 1 ,like Figure 1 As shown, the method includes:
[0140] Step 101. Obtain the structured indexed documents.
[0141] The structured index document includes multiple index entries, each of which includes tag encoding and semantic feature information. The tag encoding includes the encoded values of multiple tag dimensions, and the encoded values of each tag dimension are used to indicate the attributes of the source content or target content in the tag dimension. The semantic feature information includes multiple semantic features, and each semantic feature is used to indicate the semantic features of the source content or target content.
[0142] For example, a pre-built structured index document is retrieved. The structured index document contains multiple index entries.
[0143] Optionally, the index entries are obtained by extracting attribute features and compressing semantic understanding based on the source content.
[0144] Optionally, index entries can also be the expected attribute features and expected semantic elements of the target content to be generated.
[0145] It is understandable that index entries can include tag encoding and semantic element information. The coded values of multiple dimensions in the tag encoding represent the attribute characteristics of the source or target content in each tag dimension. The multiple semantic elements in the semantic element information represent different semantic descriptions and semantic features of the source or target content.
[0146] Step 102. In response to user input commands, generate target content based on the large model and the structured indexed documents.
[0147] Among them, user instructions represent the relevant requirements for the target content to be generated.
[0148] For example, a user inputs a user instruction, the large model parses the user instruction, and combines it with tag encoding and semantic element information from the structured index document to generate the target content. Here, the user instruction is the user's requirement for the target content to be generated, described in natural language.
[0149] Specifically, by combining tag encoding in structured index documents, the large model becomes aware of relevant attribute constraints, and by combining semantic elements, the large model refines the details of the requirements. Combining both, the large model parses the relevant requirements of user instructions and generates the target content based on the structured index documents.
[0150] The following is an example application scenario: generating code files from a structured index document based on the code domain. It can be understood that the target content is the code file.
[0151] In the aforementioned application scenarios, specifically in software development, developers need to develop code based on the existing system's architecture design. By using structured index documents as a cognitive map of a large model, index-driven code generation is achieved. Here, the cognitive map refers to the global structural information of the content library carried by the index documents, enabling the large language model to quickly establish a holistic understanding of the content library.
[0152] Specifically, in structured indexed documents in the code domain, semantic elements are defined as the four elements of FRAS. The F element is the functional element, describing the core functional responsibilities of the code file. The R element is the relational element, describing other modules or files that the code file depends on. The A element is the interface element, describing the API (Application Programming Interface) endpoints exposed or processed by the code file. The S element is the descriptive element, describing the key technical characteristics of the code file.
[0153] An example of a structured index document in the code domain is:
[0154] Index entry 1: server.js [BCC9S]: F: Server startup entry | R: app.js, dbConnection, redisConnection | A: None | S: PM2 startup, database initialization, graceful shutdown.
[0155] Index entry 2: authController.js [CCA8RM]: F: JWT authentication control | R: authService, userModel, bcrypt | A: / api / auth / login, / api / auth / register | S: 4 login methods, dual token mechanism.
[0156] Index entry 3: chatService.js [SCT9APEL]: F: Dialogue service core | R: openai, anthropic, redis | A: Internal service | S: Multi-model adaptation, streaming response, context management.
[0157] An example user instruction would be: "Generate the complete code for authController.js based on the above indexed documents."
[0158] It should be noted that BCC9S, CCA8RM, and SCT9APEL in the above index entries are tag codes. Each letter or number in the tag code corresponds to a tag dimension. The attribute represented by each tag dimension, and the attribute feature corresponding to the coded value of that tag dimension, can be flexibly set. For example, the fourth digit in the above three tag codes could represent an importance dimension. The coded value of this importance dimension is represented numerically; the higher the value, the higher the importance of the source content (original code file) corresponding to the index entry.
[0159] Specifically, the large model can be a large language model. The large language model uses F elements to determine the core responsibilities of the file (JWT authentication control), R elements to determine the dependencies that need to be introduced (authService, userModel, bcrypt), A elements to determine the API endpoints that need to be implemented ( / api / auth / login and / api / auth / register), and S elements to determine the key implementation requirements (4 login methods and a dual-Token mechanism). Simultaneously, the model understands the overall system architecture by reading other index entries, ensuring that the generated code is consistent with the interface conventions of other modules.
[0160] It should be noted that structured index documents are text-based structural information that does not contain vector representations. The index entries in a structured index document are expressed in a structured text format. Specifically, this can include any one of the following: delimiter text format, key-value pair format, or hierarchical tag format. This structured text format facilitates the recognition and extraction by the attention mechanism of large language models.
[0161] The content generation method based on indexed documents provided in this application, by acquiring a structured indexed document and using the tag encoding and semantic elements of the index entries in the structured indexed document, enables a large model to clearly and completely understand the attribute information and semantics of the source or target content. Upon receiving a user instruction, the large model, in conjunction with the structured indexed document, generates accurate target content. Specifically, based on the attribute information indicated by the tag encoding and the detailed description of the semantic elements, the large model can generate accurate target content that both meets the user's relevant needs and reflects the overall architecture. This solves the problem of insufficient expression of natural language instructions in complex tasks in traditional solutions.
[0162] Furthermore, by using structured indexed documents, based on multi-dimensional tag encoding and semantic element information, and combined with the global cognitive capabilities of a large model, accurate content generation for complex tasks can be achieved.
[0163] The technical solution provided in this embodiment uses structured index documents as the core carrier, integrating attribute constraints at the tag level (such as performance, style, domain, etc.) and detailed descriptions of semantic elements (such as code functionality, image layout, medical diagnostic logic, etc.). Through the parsing and expansion of the index documents using a large model, it solves problems such as insufficient expression of traditional natural language instructions in complex tasks, difficulties in cross-domain transfer, and weak support for incremental development. Furthermore, through the intelligent agent collaboration mechanism and shared constraint module of the centrally controlled index documents, it achieves systematic support for task decomposition, cross-domain knowledge transfer, and multimodal content generation.
[0164] Depending on the specific application scenario, the related requirements represented by user commands may also differ.
[0165] In one example, the user instruction represents a requirement to reproduce the source content based on the structured index document corresponding to the source content. It can be understood that the content obtained from reproducing the source content is the target content referred to in this embodiment.
[0166] Specifically, in response to user input commands, based on a large model and structured indexed documents, target content is generated, including:
[0167] If the user instruction represents the requirement for the generated target content as content reproduction, then based on the large model, the target content is generated according to the attributes of the source content in the tag dimension indicated by each index entry in the structured index document, as well as the semantic features of the source content.
[0168] For example, content reproduction refers to directly generating target content that is identical or similar to the source content based on existing structured index documents. It can be understood that a large model needs to combine tag encoding and semantic element information from the structured index documents to determine the attribute features of the source content across different tag dimensions, as well as the semantic descriptions and semantic features of the source content across different semantic elements. Then, it reproduces the source content, generating target content that is consistent with the attribute features of the source content across different tag dimensions and with the semantic descriptions and semantic features of the source content across different semantic elements.
[0169] It is understandable that the aforementioned exemplary user instruction, "Generate the complete code for authController.js based on the above index document," indicates a requirement for content reproduction. It is also understandable that the large model, combining this user instruction with the structured index document, generates target content (the reproduced code file) that is consistent with the source content (original code file) in terms of attribute features at the tag level and semantic features of semantic elements.
[0170] In another example, the user instruction represents a requirement for incremental development based on the structured index document corresponding to the source content. It can be understood that the content of the incremental development is the target content referred to in the embodiments of this application.
[0171] Specifically, in response to user input commands, based on a large model and structured indexed documents, target content is generated, including:
[0172] If the user instruction indicates that the relevant requirements for the target content to be generated are incremental development, then based on the large model, new index entries are generated according to the user instruction and the structured index document; based on the large model, the target content is generated according to the new index entries.
[0173] For example, incremental development refers to adding new index entries to an existing structured index document and generating expanded target content based on the new index entries.
[0174] The following is an example application scenario: incremental development of structured indexed documents based on the code domain.
[0175] In the above application scenario, the existing index document already contains index entries for modules such as user authentication and conversation services. An example user instruction is: "Add OAuth2.0 third-party login support, and integrate with instant messaging software and online platforms." It can be understood that the requirement indicated by the above example user instruction is incremental development.
[0176] Specifically, the large model (which could be a large language model) reads the structured index document to understand the current system's authentication architecture. Based on the tag encoding and semantic element information in the structured index document, and combined with the requirements in the user's instructions, it generates new index entries. Furthermore, based on the new index entries, it generates expanded target content.
[0177] For example, incremental code development can be performed using the exemplary structured index document from the aforementioned embodiments. The first step is to understand the existing index by reading the existing index document to understand the current system's authentication architecture.
[0178] The second step is impact analysis, which involves reading the R elements (related to authService, userModel, and bcrypt) of the index entries in authController.js.
[0179] The third step is to generate an incremental index: oauthService.js[SCA8EM]:F: OAuth2.0 third-party authentication service |R: authService,wechat-sdk,google-auth |A: internal service |S: instant messaging software and network platform adaptation, unified callback processing.
[0180] The fourth step is to generate code based on the incremental index. This can be understood as the incremental index being the new index entry, and the generated code being the target content for incremental development.
[0181] Building upon the above example, the method further includes: generating modification suggestions based on a large model, according to the structured index document and the new index entry; wherein the modification suggestions are suggestions for modifying the parts of the structured index document that are affected by the new index entry.
[0182] For example, during incremental development, the newly generated index entries may be related to the original index entries in the original structured index document. Thus, the generated target content and source content may also be related in the actual code. Therefore, incremental development may require modifying the original index entries.
[0183] Specifically, in the second step shown in the example above, by reading the semantic elements in the index entries, it can be identified that authService and userModel may need to be modified synchronously. It can be understood that the content of these R elements represents the part of the new index entry that affects the structured index document.
[0184] Furthermore, in the third step shown in the example above, the output could also include suggestions for modifying the original index entries in the structured index document, such as adding OAuth routes to authController.js and adding third-party binding fields to userModel.
[0185] The suggested modifications can prompt the user to make changes. Optionally, the suggested modifications can also automatically modify the index entries in the original structured index document.
[0186] In the example above, under the scenario of incremental development, modification suggestions are output for the parts of the structured index document affected by the newly added index entries, taking into account the new index entries. This ensures the coordination and compatibility between the index entries in the original index document and the new index entries during incremental development. Based on these modification suggestions, the stability of incremental development can be improved, and the cost of manual intervention can be reduced.
[0187] In another example, the user instruction represents a cross-domain migration requirement. This cross-domain migration refers to generating target content for a second domain by combining the structured index document corresponding to the source content in the first domain. The first and second domains are different application domains. It can be understood that the content corresponding to the second domain is the target content referred to in this embodiment.
[0188] Specifically, in response to user input commands, based on a large model and structured indexed documents, target content is generated, including:
[0189] If the user instruction indicates that the relevant requirement for the target content to be generated is cross-domain migration, then based on the large model, the structured index document is converted according to the user instruction to obtain the target format structured index document; based on the large model, the target content is generated according to the target format structured index document.
[0190] For example, cross-domain migration refers to converting a structured index document from a first domain into a structured index document in the format of a second domain, and generating target content based on the structured index document in the format of the second domain.
[0191] For example, for a structured index document in the code domain, if you want to display the execution process and logic of the source code file in the form of a flowchart, you need to convert the structured index document in the code domain into a structured index document in the image domain format based on a large model; and then generate the target content, i.e., the image, based on the structured index document in the image domain format.
[0192] Optionally, migration across technology stacks is also possible within the same domain. For example, the source index (Node.js technology stack) is: chatService.js[SCT9APEL]:F: Dialogue service core|R: openai, anthropic, redis|A: Internal service|S: Multi-model adaptation, streaming response, context management.
[0193] Based on a large model (which could be a large language model), the source index is first converted into an index for the target technology stack (Go language): chat_service.go[SCT9APEL]:F: Dialogue service core|R: openai-go, anthropic-go, go-redis|A: Internal service|S: Multi-model adaptation, io.Reader streaming response, context management.
[0194] Then, Go code is generated based on the target index. The F and S elements in the index retain their business semantics, while the R elements are replaced with the corresponding technology stack's dependency libraries.
[0195] In a potential test, the AI teaching platform's backend was refactored from Node.js to Go, involving approximately 82,000 lines of code and taking 3 to 4 days of spare time. The developers had almost no Go language experience. This is understandable, as it aims to improve the development efficiency of system migration across domains and code migration across technology stacks.
[0196] It should be noted that the three examples above can be implemented individually or in combination. Furthermore, when multiple examples are implemented together, user instructions can include multiple related requirements, and different target content generation logic can be executed based on the structured indexed documents according to each related requirement.
[0197] In the above embodiments, differentiated target content generation logic is implemented for different needs by distinguishing the types of related requirements indicated by user instructions. Specifically, in content reproduction scenarios, the large model ensures the consistency between the generated target content and the source content based on the tag encoding and semantic elements of the structured index document. In incremental development scenarios, new index entries are added, and the target content is generated collaboratively by combining the original structured index document and the new index entries to avoid compatibility conflicts. In cross-domain migration scenarios, the format conversion mechanism ensures that the generated new index entries conform to the format of the index entries in the domain where the target content is located. In summary, this improves the adaptability of the target content and covers more complex application requirements.
[0198] Based on the aforementioned embodiments, the semantic elements in the semantic element information of a structured index document can vary depending on the domain of the source content.
[0199] In one example, semantic element information in a structured index document is determined based on the domain of the source content corresponding to the structured index document.
[0200] For example, in the semantic element information of a structured indexed document, which specific elements are determined based on the domain to which the source content belongs.
[0201] Specifically, when the domain of the source content is the code domain, the semantic elements in the semantic element information include: functional elements, related elements, interface elements, and descriptive elements.
[0202] For example, the semantic elements of the code domain are defined as the four elements of FRAS. The F element is the functional element, describing the core functional responsibilities of the code file. The R element is the relational element, describing other modules or files that the code file depends on. The A element is the interface element, describing the API endpoints exposed or processed by the code file. The S element is the descriptive element, describing the key technical characteristics of the code file.
[0203] Specifically, when the source content is in the image domain, the semantic elements in the semantic element information include: subject elements, layout elements, aesthetic elements, symbolic elements, and output elements.
[0204] For example, semantic elements in the image domain are defined as the FLASE five elements. The F element is the subject element, describing the main content of the image. The L element is the layout element, describing the hierarchical arrangement of foreground, middle ground, and background. The A element is the aesthetic element, describing artistic style and visual processing. The S element is the symbolic element, describing emotional tone and symbolic meaning. The E element is the output element, describing output specifications and purpose.
[0205] Specifically, when the source content is in the medical field, the semantic elements in the semantic element information include: symptom elements, association elements, diagnostic elements, and treatment plan elements.
[0206] For example, semantic elements in the medical field are defined as the four elements of SCDP. The S element is the symptom element, describing the patient's main clinical presentation. The C element is the association element, describing relevant examination indicators, medical history, and differential diagnosis. The D element is the diagnosis element, describing possible diagnoses and their confidence levels. The P element is the protocol element, describing the recommended examination, treatment, and follow-up plan.
[0207] Specifically, when the source content is in the legal field, the semantic elements in the semantic element information include: clause elements, citation elements, case law elements, and restriction elements.
[0208] For example, semantic elements in the legal field are defined as the CRPL four elements. The C element is the clause element, a one-sentence summary of the core legal provision. The R element is the reference element, describing related laws, regulations, judicial interpretations, and legal doctrines. The P element is the precedent element, describing relevant precedents and their key points. The L element is the limitation element, describing applicable conditions, exceptions, and statute of limitations.
[0209] Figure 2 This is a schematic diagram illustrating the format of index entries in different fields. For example... Figure 2 As shown, the format of index entries in different fields is uniform, including identifiers, tag codes, multiple semantic elements, and the content corresponding to each semantic element.
[0210] Taking the code domain as an example, an exemplary index entry is: server.js[BCC9S]:F: Server startup entry |R: app.js,dbConnection |A: None |S: PM2 startup, graceful shutdown.
[0211] Taking the image domain as an example, an exemplary index entry is: concept_01[DXWCHS]:F: Crystal bridge connects data cliffs and AI networks|L: front-broken code; middle-bridge; back-neural network|A: 3D technology style, blue and gold brilliance|S: order triumphs over chaos|E:16:9, paper cover.
[0212] Taking the medical field as an example, an exemplary index entry is: Acute chest pain [EC9HS]: S: Sudden substernal squeezing pain for 30 minutes | C: ST segment elevation, elevated troponin | D: Acute myocardial infarction (92%) | P: Emergency PCI, dual antiplatelet therapy.
[0213] Taking the legal field as an example, exemplary index entries are: Article 107 of the Contract Law [MO9CS]: C: The breaching party shall bear the responsibility of continuing performance / compensation | R: Article 108, Article 577 of the Civil Code | P: Supreme People's Court (2019) Civil Final Appeal No. 1234 | L: Exclusions due to force majeure.
[0214] In the examples above, domain-adapted semantic element information covers a wider range of application scenarios. Based on semantic elements adapted to different domains, the targeting of structured indexed documents can be improved, thereby ensuring the domain adaptability of the generated target content. Furthermore, based on semantic elements from different domains, conversion can be performed to support the generation of target content across multiple domains.
[0215] In some potential application scenarios, taking the image domain as an example, as can be seen from the aforementioned embodiments, semantic elements in the image domain include: subject elements, layout elements, aesthetic elements, symbolic elements, and output elements. In the image domain, it is necessary to generate images as target content based on structured indexed documents.
[0216] In one example, when the source content is in the image domain, the target content is the image to be generated, and the large model is a multimodal image generation model.
[0217] Semantic elements in a structured index document are used to indicate at least one of the following: the main content, hierarchical layout, artistic style, symbolic meaning, and output specifications of the image to be generated.
[0218] For example, for a structured index document, if its source content is in the image domain, it indicates that the structured index document is formed by compressing the original image. It can be understood that, in the image domain, the target content to be generated is the image to be generated.
[0219] Furthermore, the large model can be a multimodal image generation model. Based on the image generation model, in response to user input commands, images are generated according to structured indexed documents in the image domain.
[0220] Optionally, in structured index documents in the image domain, the semantic elements in the semantic element information of the index entries need to indicate relevant information about the image to be generated. This relevant information includes at least one of the following: main content, hierarchical layout, artistic style, symbolic meaning, and output specifications.
[0221] As illustrated by the preceding examples, in the image domain, the subject element within semantic elements indicates the main content of the image to be generated. The layout element within semantic elements indicates the hierarchical layout of the image to be generated. The aesthetic element within semantic elements indicates the artistic style of the image to be generated. The symbolic element within semantic elements indicates the symbolic meaning of the image to be generated. The output element within semantic elements indicates the output specifications of the image to be generated.
[0222] Optionally, the output specifications indicated by the semantic elements include, but are not limited to, the resolution and format of the image to be generated. The resolution can be set to the aspect ratio, and the format can be set to different image formats.
[0223] In the above example, the semantic elements in the structured index document can provide clear and complete indications of various details of the image to be generated, ensuring that the large model generates an accurate image as the target content.
[0224] In image generation, the core challenge is consistency. This means that the same character in an image appears inconsistent across multiple generation iterations, the style of the same scene drifts, and consecutive frames lack visual coherence. Related technologies lack a structured, white-box constraint mechanism to ensure consistency in the generation of consecutive images.
[0225] Therefore, based on the aforementioned example, the method also includes:
[0226] Obtain at least one shared constraint module; wherein, the shared constraint module is used to define attribute constraints that are commonly referenced by multiple index entries; the attribute constraints include at least one of role constraints, style constraints, and scene constraints.
[0227] Furthermore, the process of generating target content based on a large model and structured indexed documents can specifically include:
[0228] Based on a multimodal image generation model, multiple images to be generated are generated according to each index entry in a structured index document and at least one shared constraint module. The images to be generated correspond to the index entries.
[0229] For example, the shared constraint module includes multiple attribute constraints, which are used to make multiple index entries reference each other so that the generated multiple images to be generated all satisfy the attribute constraints.
[0230] Specifically, attribute constraints can include role constraints, style constraints, and scene constraints.
[0231] Character constraints are used to define a character's appearance, clothing, and temperament to ensure visual or semantic consistency for the same character across multiple content generation processes.
[0232] Style constraints are used to define artistic style, color preferences, and lighting characteristics to ensure stylistic consistency across multiple content units.
[0233] Scene constraints are used to define the spatial characteristics, environmental elements, and atmosphere of a scene, ensuring the scene coherence of multiple content units.
[0234] An example role constraint in the shared constraint module could be: @CHARACTER the_architect: Appearance: 48-year-old Asian male, short hair, black-rimmed glasses, focused and confident eyes, slightly bookish; Clothing: Simple dark polo shirt, khaki casual pants, holding a tablet computer; Temperament: Calm, in control of the overall situation, drives complex systems through simple instructions.
[0235] An example style constraint in the shared constraint module could be: @STYLE tech_vision: Art style: 3D technology illustration; Color tendency: dark blue background with gold glow; Lighting characteristics: strong volumetric light, with the light source emanating from the direction of the subject.
[0236] Figure 3 This is an example of a flowchart illustrating the process of generating target content using a shared constraint module, such as... Figure 3 As shown, the role constraints and style constraints in the shared constraint module, along with the index entries in the structured index document, are input into the image generation model. The image generation model generates multiple images to be generated based on each index entry, with each image corresponding one-to-one with an index entry.
[0237] Furthermore, when generating multiple images, the image generation model ensures consistency in characters, styles, and scenes across the images based on character and style constraints. In other words, the image generation model adheres to both the index entry description and the constraints of the shared constraint module when generating images, guaranteeing consistency in character appearance, artistic style, and scene settings across consecutively generated images.
[0238] Specifically, the index entry for Image 1 is: aoci_concept_01[DXWCHS]:F: A glowing crystal bridge connects the chaotic data cliff on the left to the AI neural network on the right |L: Foreground - Broken code characters at the edge of the cliff; Middle - Crystal bridge spanning the abyss; Back - Huge glowing neural network |A: Citation @STYLEtech_vision |S: Order triumphs over chaos, connecting the fault lines |E:16:9, Paper cover.
[0239] The index entry for Image 2 is: aoci_concept_02[DXWCHS]:F: Reference @CHARACTERthe_architect stands in front of the console, touches the virtual panel with his finger, and the panel displays the mapping relationship between code and index |L: Front - console; Middle - the_architect; Back - semi-transparent system architecture projection |A: Reference @STYLEtech_vision |S: Sense of control, human-computer collaboration |E: 16:9, inner page of the paper.
[0240] The index entry for image 3 is: aoci_concept_03[DXWCHS]:F: Reference @CHARACTERthe_architect Walking through a crystal corridor, with index documents from different fields displayed on both sides |L: Front - Footsteps; Middle - Corridor; Back - Distant light |A: Reference @STYLEtech_vision |S: Cross-domain, unified methodology |E: 16:9, Paper inner page.
[0241] When generating each image, the image generation model simultaneously reads the image's index entry and the referenced shared constraint modules. `@CHARACTER` ensures that the `architect` maintains the same appearance, clothing, and style across the three images, while `@STYLE` ensures consistency in artistic style, color, and lighting effects across the three images. Each index entry defines the unique content of the image through F / L / A / S / E features, and the shared constraint modules define consistency anchors across images.
[0242] Optionally, shared constraint modules are similar to shared dependency mechanisms in code: multiple code files may depend on the same authService module, and multiple images may reference the same @CHARACTER definition. Modifying the @CHARACTER definition will reflect this change when all images referencing it are regenerated, achieving a "one-stop-shop" consistency.
[0243] In the example above, the shared constraint module can impose attribute constraints on index entries in the image domain index document. Combined with the shared constraint module, the image generation model can ensure that the attributes of each image to be generated satisfy the attribute constraints indicated by the shared constraint module during the generation of multiple images. This improves the consistency of different images to be generated during the multi-image generation process.
[0244] In multi-agent systems, as the number of agents and the variety of tools available to them increase, the lead agent struggles to gain a global understanding of the entire system within a limited context window, leading to inefficient task planning and scheduling. Related multi-agent frameworks typically employ code-level configuration, with configurations scattered across multiple files, preventing the lead agent from obtaining a complete system overview in a single inference iteration. This is particularly problematic when the system dynamically expands, as there is a lack of effective incremental update mechanisms.
[0245] Based on the aforementioned fields and the relevant requirements indicated by user instructions, we will take the generation of medical documents as an example to illustrate the concept. Specifically, we will generate knowledge documents based on structured indexed documents in the medical field.
[0246] For example, an index entry in the medical field is: Differential diagnosis of acute chest pain.guide[EC9HS]: S: Sudden onset of retrosternal squeezing pain accompanied by profuse sweating | C: ST segment changes on ECG, troponin, D-dimer, chest CT | D: Acute coronary syndrome vs. pulmonary embolism vs. aortic dissection | P: Immediate ECG with troponin, rule out fatal triad.
[0247] For example, the user instruction is: "Based on the above index, generate a standardized differential diagnosis process document for acute chest pain in the emergency department."
[0248] The large model uses S-factors to determine the symptom description sections of the document, C-factors to determine the checklist, D-factors to determine the differential diagnosis decision tree, and P-factors to determine the treatment process. Finally, a knowledge document is generated as the target content.
[0249] Based on the aforementioned fields and the relevant requirements indicated by user instructions, we will illustrate this with an example of generating legal documents. Specifically, this involves generating legal documents based on structured indexed documents in the legal field.
[0250] For example, the index entry in the legal field is: Termination of Employment Contract.analysis[ML8CS]:C: Statutory circumstances and procedural requirements for unilateral termination of employment contracts by employers|R: Articles 39 to 41 of the Labor Contract Law, Labor Dispute Mediation and Arbitration Law|P: Supreme People's Court Labor Dispute Guiding Case No. 12|L: The calculation of N+1 for economic compensation needs to distinguish between years of service before and after 2008.
[0251] For example, the user instruction is: "Based on the above index, generate a legal opinion on the employer's lawful termination of the labor contract."
[0252] The large model uses C elements to determine the core arguments of the opinion letter, R elements to list the legal basis, P elements to cite supporting precedents, and L elements to highlight important points.
[0253] After parsing the user's instructions, the large model (which could be a large language model) generates the corresponding legal document, i.e., the target content, based on the index entries in the structured indexed document of the input legal domain.
[0254] To generate teaching documents based on legal index entries, the first step is to modify the format of the legal index entries to obtain the corresponding educational index entries, which will then be used to generate the teaching documents.
[0255] For example, source index entries (legal field): Article 107 of the Contract Law [MO9CS]: C: The breaching party shall continue to perform or compensate | R: Article 108, Article 577 of the Civil Code | P: Supreme People's Court (2019) Civil Final Appeal No. 1234 | L: Exclusions due to force majeure.
[0256] The large model reads source index entries from the legal field, understands the core legal concepts, and then converts them into the format of index entries from the educational field.
[0257] For example, the target index (education field): Contractual Breach of Liability.edu[JY5NM]: E: Understanding the three ways of assuming liability for breach of contract | R: Contract formation, contract performance | A: Undergraduate law students, exam takers | S: Continuing performance takes precedence, and the scope of compensation includes expected profits.
[0258] Specifically, semantic elements are converted from CRPL to ERAS (teaching objectives - prerequisite knowledge - applicable audience - core points), and then teaching documents are generated based on the target index in the education field.
[0259] Figure 4 A flowchart illustrating the content generation method based on indexed documents provided in this application. Figure 2 ,like Figure 4 As shown, the method provided in this embodiment is... Figure 1 In addition to the embodiments, it also includes:
[0260] Step 401. Input the structured index document as the central control index document into the main intelligent agent.
[0261] The main intelligent agent is used for task planning and sub-agent scheduling based on the central control index document.
[0262] The exemplary application background of this embodiment is as follows: A complex AI application system contains multiple collaborative intelligent agents. The master intelligent agent needs to understand the capability boundaries, available tools, workflows, and knowledge base content of all sub-intelligent agents in order to perform effective task planning and scheduling. A structured index document is used as the central control index document and input into the master intelligent agent.
[0263] For example, a structured index document serves as a central index document, which comprises six regions, each containing one or more index entries.
[0264] Region 1, Main Agent Definition Area: MainAgent[PC9HL]: R: Task Scheduling Center | Capabilities: Task understanding, task decomposition, sub-agent scheduling, result integration, exception handling | Permissions: Global control, resource allocation | Strategies: Priority scheduling, load balancing, retry 3 times on failure.
[0265] Region 2, the sub-agent definition area, includes the following index entries:
[0266] CodeAgent[SC8ML]: R: Code Generation Expert | Capabilities: Code writing, code refactoring, code review, unit test generation | Input: Requirements description | Output: Code file | Constraints: No more than 500 lines per batch, manual confirmation required.
[0267] SearchAgent[SR8NM]: R: Information Retrieval Expert | Capabilities: Web Search, Knowledge Base Retrieval, Document Summary | Input: Query | Output: Structured Results | Constraints: Maximum 100 queries per minute.
[0268] AnalyzeAgent[SA7MS]: R: Data Analysis Expert | Capabilities: Statistical Analysis, Trend Prediction, Visualization | Input: Dataset | Output: Analysis Report | Constraints: Data size not exceeding 100MB.
[0269] Area 3, the tool registration area, includes the following index entries:
[0270] web_search[TR9LM]:T: Real-time web search|Parameters:query (required),max_results (default 10)|Constraint:100 times / minute|Consumption:0.01 points / time.
[0271] code_executor[TE8HM]: T: Safe code execution | Parameters: code (required), language (default python), timeout (30 seconds) | Constraints: Sandbox environment, network disabled | Cost: 0.1 points / execution.
[0272] Area 4, Workflow Configuration Area: coding_workflow[WE9HL]: W: Code Development Process | Stage: Requirements Analysis → Design → Coding → Testing → Review | Branch: Return to coding if test fails | Timeout: 30 minutes per stage | Exception: Notify manual intervention after 3 consecutive failures.
[0273] Area 5, Communication Protocol Area: agent_protocol[CC9NM]:C: Communication Protocol|Format: JSON including sender / receiver / type / content / timestamp|Synchronization: Reporting at the end of each phase|Conflict: Arbitration by the main agent|Permissions: Sub-agents inherit basic permissions.
[0274] Area Six, Knowledge Base Index: tech_knowledge[KR7MM]: K: Technical Knowledge Base | Category: Programming Languages / Frameworks / Tools / Best Practices | Search: Hybrid Search | Update: Weekly | Credibility: Official Documentation 9 points, Community 7 points, AI Generated 5 points.
[0275] It should be noted that the number of regions in the central control index document can be increased or decreased according to actual needs. This embodiment does not limit the partitioning method in the central control index document. For example, merging the communication protocol region and the workflow configuration region, or adding a security policy region, etc., the core principle remains unchanged.
[0276] Step 402. In response to the main agent receiving the user task, the main agent determines the target sub-agent based on the sub-agent definition area in the central control index document.
[0277] The sub-agent definition area includes index entries indicating the professional domain, input / output specifications, calling interfaces, and collaboration constraints of each sub-agent; the target sub-agent is the sub-agent capable of solving the user's task.
[0278] For example, a user sends a task request, and the main agent receives the user's task. Based on the sub-agent definition area in the central control index document, the main agent identifies the professional domain, input / output specifications, calling interfaces, and collaboration constraints of each sub-agent, ultimately identifying the sub-agent with the required capabilities as the target sub-agent. It can be understood that the target sub-agent is an agent capable of executing the user's task.
[0279] Step 403. Based on the workflow configuration area in the central control index document, the main intelligent agent decomposes the user task to obtain at least one subtask and determines the execution order and dependency relationship of each subtask.
[0280] The workflow configuration area includes index entries for indicating task decomposition rules, execution order, branching conditions, state transitions, and exception handling.
[0281] For example, the main agent reads the workflow configuration area in the central control index document to understand the task decomposition rules, execution order, branch conditions, condition transformations, and exception handling information. Furthermore, it decomposes the user task into at least one subtask, and based on the information in the workflow configuration area, determines the execution order of each subtask and whether there are dependencies between them.
[0282] Step 404. Based on the tool registration area in the central control index document, the master agent determines the available tools and constraints of each sub-agent.
[0283] The tool registration area includes index entries that indicate the functional descriptions, parameter specifications, invocation constraints, and resource consumption of available tools for each sub-agent.
[0284] For example, the master agent reads the tool registration area in the central control index document to determine the relevant information of the available tools for each sub-agent. This includes the relevant information of the available tools for the target sub-agent.
[0285] It is understandable that, based on the relevant information indicated in the tool registration area, the main intelligent agent can know what tools are available to the target sub-intelligent agent, what the available tools can do, and the parameter specifications, calling constraints, and resource consumption of the available tools.
[0286] Step 405. Based on the main intelligent agent, the target sub-intelligent agent is scheduled to execute sub-tasks, and message passing and state synchronization are performed according to the communication protocol area in the central control index document.
[0287] The communication protocol area includes index entries that indicate semantic interaction protocols, state synchronization mechanisms, conflict resolution rules, and permission inheritance relationships between agents.
[0288] For example, the main agent invokes the target sub-agent to execute a sub-task using available tools, and performs message passing and state synchronization in accordance with the communication protocol section indicated in the central control index document. Specifically, this includes receiving the execution results of the sub-task from the target sub-agent using the required communication method.
[0289] The semantic interaction protocol is used to indicate the semantic layer communication rules agreed upon between agents, including the defined message meanings, interaction logic, and semantic specifications of instructions and responses, so that agents can accurately understand each other's communication intentions.
[0290] The state synchronization mechanism is used to indicate how state data is distributed among agents, when it is synchronized, and which data is used as the standard, so as to maintain state consistency among agents.
[0291] Among them, conflict resolution rules are used to indicate: predefined adjudication rules when conflicts occur between agents. For example, when resource contention, instruction conflict, or state conflict occurs, conflict resolution is carried out according to predefined priorities among agents.
[0292] Among them, the permission inheritance relationship is used to indicate the hierarchical rules for the transfer and attribution of permissions between agents.
[0293] Step 406. Based on the execution results received by the main intelligent agent from the target sub-intelligent agent, integrate them to obtain the final result corresponding to the user task.
[0294] For example, the execution results of the sub-tasks returned by the target sub-agent are integrated based on the main intelligent agent to obtain the final result of the user task, and then feedback is given to the user.
[0295] It should be noted that although the operations are described in a specific order, this should not be interpreted as requiring these operations to be executed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.
[0296] That is, steps 402 to 405 above can be executed synchronously or sequentially during actual execution, and the order of execution is not limited by the step number.
[0297] In the above embodiments, a structured index document is used as the central control index document. Based on this central control index document, the main intelligent agent can perform task planning and schedule sub-intelligent agents. Specifically, by combining the content of different partitions in the central control index document, the functions of sub-intelligent agents can be identified, the workflow of sub-intelligent agents can be determined, the available tools of sub-intelligent agents can be identified, and the communication methods of sub-intelligent agents can be identified. Finally, the main intelligent agent schedules the sub-intelligent agents to execute the divided sub-tasks based on the central control index document, and finally integrates them to obtain the final result of the user task.
[0298] Optionally, the method further includes at least one of the following:
[0299] When a new sub-agent is added, an index entry corresponding to the new sub-agent is added to the sub-agent definition area in the central control index document;
[0300] When a new available tool is added, an index entry corresponding to the new available tool is added to the tool registration area in the central control index document;
[0301] When a workflow changes, the index entries corresponding to the changed workflow are updated in the workflow configuration area of the central control index document.
[0302] For example, when a new sub-agent is added to a multi-agent system, the index entry corresponding to the new sub-agent is appended to the sub-agent definition area in the central control index document.
[0303] Optionally, when adding a new sub-agent, you can choose to synchronously update the index entries in the workflow configuration area and the index entries in the communication protocol area.
[0304] Specifically, adding a new sub-agent may affect the workflow of an existing multi-agent system, requiring updates to the index entries for the changed workflow. Furthermore, the new sub-agent may correspond to a new communication method, necessitating updates or additions to the index entries in the communication protocol area.
[0305] For example, when a sub-agent adds a new available tool, the index entry corresponding to the new available tool is appended to the tool registration area in the central control index document.
[0306] For example, when a workflow changes, the index entries for the changed workflow are updated in the workflow configuration area of the central control index document.
[0307] Figure 5 This is a schematic diagram illustrating the processing flow of an exemplary multi-agent system. Figure 5 As shown, the central control index document includes six areas: main agent definition area, sub-agent definition area, tool registration area, workflow configuration area, communication protocol area, and knowledge base index area.
[0308] The main agent definition area includes index entries for the main agent's role definition, capability boundaries, decision-making authority, and scheduling strategy.
[0309] The sub-agent definition area includes index entries for each sub-agent's domain of expertise, input / output specifications, calling interfaces, and cooperation constraints.
[0310] The tool registration area includes index entries for the functional descriptions, parameter specifications, calling constraints, and resource consumption of the tools available to each agent.
[0311] The workflow configuration area includes index entries for task decomposition rules, execution order, branch conditions, state transitions, and exception handling.
[0312] The communication protocol section includes index entries for semantic interaction protocols between agents, state synchronization mechanisms, conflict resolution rules, and permission inheritance relationships.
[0313] The knowledge base index area includes index entries for knowledge classification, retrieval path, update frequency, and credibility level.
[0314] Based on this, it has a dynamic update mechanism.
[0315] When a new sub-agent is added, an index entry corresponding to the new sub-agent is added to the sub-agent definition area.
[0316] For example, a new TranslateAgent can be added for multilingual translation. Only one index entry needs to be appended to the sub-agent definition area; the entire central index does not need to be regenerated.
[0317] When a new tool is added, an index entry corresponding to the new tool is added to the tool registration area.
[0318] The quality level can be adjusted based on the execution feedback of the sub-agent. That is, the quality level label of the sub-agent in the central control index document is dynamically adjusted according to the historical execution success rate of the sub-agent.
[0319] For example, if CodeAgent requires manual correction in 3 out of 5 consecutive tasks, the system will downgrade CodeAgent's quality level from 8 (Excellent) to 7 (Good). In subsequent scheduling, the main agent will prioritize assigning simpler tasks to CodeAgent or add a review process.
[0320] Specifically, the calculation logic for dynamic adjustment is as follows: The system maintains the execution records of the N most recent tasks for each sub-agent, where N is the preset evaluation window size, for example, N is 10.
[0321] The historical execution success rate is calculated as follows: the success rate Q equals the number of tasks successfully completed within the evaluation window divided by N.
[0322] The system presets a downgrade threshold T_down and an upgrade threshold T_up. For example, T_down is set to 0.6 and T_up is set to 0.9.
[0323] When Q is lower than T_down, a downgrade mechanism is triggered, which lowers the quality level label of the sub-agent in the central control index document by one level, for example, from 8 to 7; when Q is higher than T_up and remains so for M consecutive evaluation cycles (for example, M is 3), an upgrade mechanism is triggered, which raises the quality level label by one level.
[0324] Adjustments to the quality level are directly reflected in the corresponding index entries of the central control index document. The main agent can detect this change the next time it reads the central control index document and adjust the scheduling strategy accordingly, such as assigning simpler tasks to sub-agents with lower quality levels or adding a result review step. The parameters N, T_down, T_up, and M can all be configured according to the actual application scenario.
[0325] When knowledge is updated, the credibility level is adjusted. That is, based on the update status of the knowledge base, the credibility level and update frequency of the corresponding entries in the knowledge base index area are adjusted.
[0326] For example, the knowledge base has added official documentation for a front-end framework. A corresponding index entry has been added to the knowledge base index area, marked with a credibility score of 9.
[0327] Figure 6 This is an example of an interaction signaling diagram within a multi-agent system. Combined with... Figure 6 The process shown will be explained.
[0328] After a user sends a task request, the primary agent receives the task, reads the central control index document, and obtains a global cognitive map. This global cognitive map reflects the overall architecture information of the multi-agent system.
[0329] The main intelligent agent decomposes and plans user tasks based on the workflow configuration area in the central control index document.
[0330] The main agent queries the sub-agent capability boundaries based on the sub-agent definition area in the central control index document, and then determines the target sub-agent.
[0331] like Figure 6 As shown, the target sub-agent is a code agent. The code agent can handle code tasks.
[0332] Furthermore, the main agent schedules the code agents to execute subtasks. During the execution of these subtasks, the code agents can also read the central control index document to query available tools.
[0333] Then, the code agent calls the code execution tool to execute subtasks and obtain the execution results.
[0334] The code agent feeds back the execution results of the subtasks to the main agent.
[0335] Optional, such as Figure 6 As shown, there can be one or more target sub-agents.
[0336] like Figure 6 As shown, in addition to the code agent, the target sub-agents can also include a retrieval agent.
[0337] Furthermore, the retrieval agent is scheduled to execute subtasks based on the master agent. During the execution of subtasks by the retrieval agent, the central control index document can also be read to query the available tools for the retrieval agent.
[0338] Then, the retrieval agent invokes the search tool to execute sub-tasks and obtain search results.
[0339] The retrieval agent feeds back the search results of the subtasks to the main agent.
[0340] The main agent integrates the results returned by the code agent and the retrieval agent, and returns the final response to the user.
[0341] For example, interaction steps within a multi-agent system may include the following steps:
[0342] The first step is for the main intelligent agent to read the central control index document upon startup and establish global awareness.
[0343] The main agent learns that the system has 3 sub-agents, 2 tools, 1 workflow, and 1 knowledge base.
[0344] The second step involves the user submitting a task: "Help me develop a user registration function." The main agent identifies CodeAgent's coding capabilities based on the sub-agent's definition. Here, CodeAgent is... Figure 6 The code-based intelligent agent.
[0345] The third step involves the main agent breaking down the task into five stages: requirements analysis, design, coding, testing, and review, based on the coding_workflow rules in the workflow configuration area.
[0346] Fourth, the main agent learns from the tool registration area that CodeAgent can use the code_executor tool (i.e. Figure 6 (The code execution tool in the document), and the tool runs in a sandbox environment.
[0347] Fifth, the main intelligent agent schedules CodeAgent to execute the encoding task and transmits messages according to the rules of the communication protocol area.
[0348] Step 6: After CodeAgent completes the encoding, the main agent schedules the test. If the test fails, it returns to the encoding stage according to the workflow configuration.
[0349] Step 7: After all stages are completed, the main intelligent agent integrates the results and returns them to the user.
[0350] In the example above, when attributes in the multi-agent system change, it is not necessary to regenerate the entire central control index document. Instead, based on an incremental development model, new index entries are generated, and the central control index document is updated. This allows for updates to the multi-agent system, reducing the amount of redevelopment required for system updates and improving the efficiency of system updates.
[0351] Specifically, through the central control index document, the main agent gains a complete understanding of the entire system from the text of approximately 2,000 to 5,000 tokens, covering the capability boundaries, tool constraints, workflow rules, and knowledge base information of all sub-agents. This white-box central control approach allows developers to directly read and edit the main agent's cognitive content, fundamentally different from black-box configuration schemes based on vector retrieval.
[0352] In terms of model training, taking the code domain as an example, the training data mainly comes from open-source code repositories. This data only contains the code itself and lacks information on the architectural intent dimension. The trained model learns the syntax patterns and local patterns of the code, but lacks an understanding of architectural layer information such as the role of files in the system, business dependencies between files, and differences in the importance of different files.
[0353] Figure 7A flowchart illustrating the content generation method based on indexed documents provided in this application. Figure 3 ,like Figure 7 As shown, the method also includes:
[0354] Step 701. Obtain the source content corresponding to the structured index document.
[0355] For example, the source content of structured index documents is obtained as the basis for subsequently constructing training sample pairs. It can be understood that the data sources for training sample pairs include: content libraries (including code or documents, etc.) and the corresponding index documents.
[0356] Step 702. Construct multiple training sample pairs based on the index entries in the structured indexed documents and the source content corresponding to the index entries.
[0357] For example, index entries and their corresponding source content are aligned to form a training sample pair. This training sample pair includes the index entry used as a training sample and the source content used as a label value. Alternatively, the training sample pair includes the source content used as a training sample and the index entry used as a label value.
[0358] Step 703. Based on multiple training sample pairs, perform supervised fine-tuning training on the large model.
[0359] For example, multiple training sample pairs are input into a large model to train the parameters of the large model on visibility, and the parameters of the large model are then fine-tuned.
[0360] It should be noted that the above training sample pairs can also be called Index-Content Aligned Training Data: these are training sample pairs formed by pairing structured index entries with corresponding source content, used to enable large models to understand the mapping relationship between architectural intent and content implementation.
[0361] Specifically, the multiple training sample pairs include forward training sample pairs and backward training sample pairs.
[0362] In the forward training sample pairs, the index entries are used as training samples, and the source content corresponding to the index entries is used as the label value; in the reverse training sample pairs, the source content corresponding to the index entries is used as training samples, and the index entries are used as label values.
[0363] For example, in a positive training sample pair, the input is an index entry: authController.js[CCA8RM]:F: JWT authentication control|R: authService,userModel,bcrypt|A: / api / auth / login, / api / auth / register|S: 4 login methods, dual-Token mechanism.
[0364] The output is the complete source code file content of the corresponding source code: authController.js.
[0365] For example, in the reverse training sample pair, the input is the source code: the complete source code file content of authController.js.
[0366] The output is an index entry: authController.js[CCA8RM]:F: JWT authentication control|R: authService,userModel,bcrypt|A: / api / auth / login, / api / auth / register|S: 4 login methods, dual token mechanism.
[0367] By using forward and backward training sample pairs, the large model can gain a comprehensive and bidirectional understanding of the relationship between index entries and source content during training, thereby improving the accuracy of the large model in generating target content during application.
[0368] Optionally, training sample pairs have weight values in the loss function, which indicate the contribution of the training samples to supervised fine-tuning of the large model. The weight values of the training sample pairs are positively correlated with the encoded values of the importance dimension in the label encoding of the index entries.
[0369] For example, the weight of an index entry in the loss function is adjusted based on the encoding value corresponding to the importance dimension of the label encoding in the index entry. The loss function is a function used to evaluate the training progress during supervised fine-tuning training of a large model based on training sample pairs. During training, the weight values of each training sample pair in the loss function enable the large model to learn more deeply about highly important content.
[0370] The specific weight mapping relationship is as follows: importance 9 corresponds to weight coefficient 3.0, importance 8 corresponds to weight coefficient 2.0, importance 7 corresponds to weight coefficient 1.5, importance 5 corresponds to weight coefficient 1.0, importance 3 corresponds to weight coefficient 0.5, and importance 1 corresponds to weight coefficient 0.3.
[0371] The adjusted loss function, L_weighted, is equal to the sum of all w_i multiplied by L_i, where w_i is the weight coefficient determined according to the encoding value corresponding to the importance dimension, and L_i is the original loss value of the i-th training sample pair.
[0372] This weighted strategy allows the model to learn more deeply about core system code (such as authentication services, dialogue engines, etc., which have an importance of 9), while learning less about peripheral tool files (which have an importance of 1).
[0373] It is understandable that the encoded value corresponding to the importance dimension can be used for differential weighting of training samples during model training.
[0374] Optionally, the encoded values corresponding to the importance dimension can also guide the large language model to provide a more accurate implementation of high-importance content units during the content generation operation.
[0375] Optionally, the encoded values corresponding to the importance dimension can also guide the main agent to prioritize resource allocation during agent scheduling operations.
[0376] By leveraging the importance dimension of the labels encoded in the index entries, the contribution of different training samples to supervised fine-tuning of the large model can be adjusted. More important index entries receive higher training weights, while less important ones receive lower weights. This differentiated approach to training the large model improves both the accuracy of the generated target content and the speed of fine-tuning, thereby increasing the overall training efficiency.
[0377] In the above embodiments, by constructing training data aligned with index entries and source content, an architectural intent dimension is added to the training data. By pairing index entries with source content, the large model not only learns the attributes of the source content but also the correspondence between architectural intent and source content. Taking the code domain as an example, the large model not only learns the syntax patterns of code but also learns what kind of architectural intent corresponds to what kind of code implementation. In addition, weighted training based on the importance dimension further enables the model to learn index entries and source content more deeply. Again, taking the code domain as an example, reducing the learning intensity for marginal code better reflects the importance distribution in actual development.
[0378] Based on the aforementioned embodiments, consistency evaluation can be performed on the target content generated by the large model.
[0379] In one example, the method further includes:
[0380] Input the target content into the large model to generate inverted index entries;
[0381] Calculate the consistency score based on the inverted index entries and the index entries in the structured index documents.
[0382] The consistency score is used to characterize the degree of consistency between inverted index entries and index entries in structured index documents.
[0383] For example, the target content generated by the large model is re-input into the large model, and the index entries corresponding to the target content, i.e., inverted index entries, are regenerated based on the target content.
[0384] Furthermore, a consistency score is calculated based on the original index entries in the original structured index document and the newly generated inverted index entries. This consistency score, also known as the Architecture Consistency Score (ACS), is an evaluation metric calculated by comparing the generated index with the reference index across multiple dimensions. It quantifies the model's architectural understanding capability. A higher ACS indicates better consistency between the generated content and the design intent at the architectural level.
[0385] Figure 8 This is a schematic diagram of an exemplary index evaluation process, such as... Figure 8 As shown, taking the code domain as an example, the following exemplary steps may be included:
[0386] Step 1: Provide a code generation requirement description and a structured index document of the reference code domain.
[0387] Step 2: The large model generates target content, i.e., code files, based on the requirements.
[0388] Step 3: For the code file generated from the large model, use a separate index entry generation process to generate inverse index entries for the code file.
[0389] Step 4: Compare each index entry generated in reverse with the index entries in the reference index document, calculate the deviation, and then calculate the consistency score.
[0390] Combination Figure 8 This section explains how to calculate the consistency score. The comparison process can be conducted across different dimensions, with scoring assigned to each dimension. Specific scoring rules include:
[0391] For label coding comparison, each dimension is scored independently. Dimension A is scored 1 point for correctness, Dimension B is scored 1 point for correctness, Dimension C is scored 0.5 points for correctness within one level of deviation, Dimension D is scored 1 point for correctness, and Dimension E is scored 1 point for correctness. The maximum score for label coding is 5 points.
[0392] In terms of semantic element comparison, the semantic similarity of element F is 0 to 1, the dependency coverage of element R is 0 to 1, the interface matching rate of element A is 0 to 1, and the key feature coverage of element S is 0 to 1. The maximum score for semantic elements is 4.
[0393] In terms of structural integrity comparison, 0.5 points will be deducted for each missing file and 0.3 points will be deducted for each redundant file.
[0394] The formula for calculating the Architecture Consistency Score (ACS) is: ACS equals the label encoding score plus the semantic element score minus the structural bias deduction, divided by 9, and then multiplied by 100%. This consistency score can be understood as a quantitative assessment of the architecture understanding capability of large models.
[0395] In the example above, the consistency score reflects the large model's understanding of the global architecture. Furthermore, the consistency score can be used to adjust the parameters of the large model, indirectly improving the accuracy of target content generation. This reduces the deviation between the generated target content and user needs and optimizes the model's adaptability. Additionally, it enables a quantitative assessment of the large model's understanding capabilities at the architectural level.
[0396] Based on any of the foregoing embodiments, in one optional implementation of the target content generation process, generation can be performed based on multiple stages.
[0397] Responding to user input of requirement descriptions, and based on a large model, generating structured indexed documents according to the requirement descriptions;
[0398] In response to user modifications to the structured index documents, target content is generated based on the modified structured index documents using a large model.
[0399] For example, in the first stage, the user's requirement description is received, and the large model (which can be a large language model) generates a structured index document based on the requirement description. This structured index document serves as an explicit intermediate step in reasoning.
[0400] The next stage is the review phase, where users review the structured index documents generated in the first stage. This review includes both manual and / or automated review. The structured index documents are human-readable and editable text-based structured information.
[0401] Understandably, users can modify and optimize structured index documents during the review process to obtain modified structured index documents.
[0402] Finally, in the second stage, in response to user modifications to the structured index document, the large language model generates the target content based on the modified structured index document.
[0403] It should be noted that the above method of generating target content based on the first and second stages, combined with the review stage, can be called two-stage generation. This means that the large model first generates structured index entries, resulting in index documents. The target content is then generated based on these index documents as an explicit inference intermediate step and after manual review.
[0404] In one exemplary application scenario, a user needs to develop a complete online education system, including multiple modules such as course management, user management, payment, and notification.
[0405] Phase 1: Index generation.
[0406] The user input-related requirements are described as follows: Develop an online education system that includes course management (course CRUD, chapter management, video management), user management (registration and login, role permissions), payment (course purchase, refund), and notifications (email, in-app messages).
[0407] Large language model generates indexed documents (only a portion of the index entries are shown here):
[0408] Index entry 1: courseController.js [CCK8M]: F: Course Management Controller | R: courseService, authMiddleware | A: / api / course / |S: Course CRUD operations, paginated query, permission verification.
[0409] Index entry 2: courseService.js [SCK8L]: F: Course business logic | R: courseModel, chapterModel, videoService, redis | A: Internal services | S: Course publishing process, chapter sorting, caching strategy.
[0410] Index entry 3: paymentService.js [SCP9PTM]: F: Course payment service | R: orderModel, wechatPay, alipay, courseService | A: Internal service | S: Unified payment interface, asynchronous callback, refund logic.
[0411] Index entry 4: notificationService.js [SCN7AM]: F: Notification Service | R: emailTransport, messageModel, userModel | A: Internal Service | S: Email Queue, Internal Message, Template Engine.
[0412] Then the review phase began. The index entries in the index document were reviewed, and the following issues were found: the importance level of paymentService should be 9 (core level) instead of 7 (business level), because payment is a core process; a pricing strategy module was missing; and the notification module should include an SMS channel. The index document was manually modified directly using a text editor to improve the architecture design.
[0413] Finally, we move to the second stage: content generation. The large language model generates code file by file based on the reviewed index documents. The index ensures: consistent interface conventions across files (the output format of courseService matches the input format of paymentService), correct dependencies (dependencies are explicitly listed in R elements), and no key implementation requirements are omitted (high-entropy information is recorded in S elements).
[0414] In an exemplary application scenario, taking the medical field as an example, the first stage involves receiving clinical requests for updating the treatment guidelines for type 2 diabetes. The model generates an index framework, listing the required knowledge units and their relationships. The review stage involves clinical experts reviewing the index framework to confirm coverage of the latest evidence-based data and drug recommendations. The second stage involves generating a complete treatment guideline document based on the reviewed index. This method ensures that the generated medical documents have undergone expert review at the architectural level, reducing the risk of missing key information.
[0415] The relevant technologies are compared and explained using the above exemplary application scenarios. In traditional single-stage generation, the model generates all code directly from the requirements description. When generating to the paymentService, the interface format defined by courseService may have been forgotten, leading to interface mismatches. In two-stage generation, however, the index document serves as a persistent architectural blueprint, ensuring consistency across files.
[0416] In the thought chain approach, the model's internal reasoning process is invisible to the user, making it impossible for them to detect architectural design errors such as underestimating the importance of the payment module. In contrast, in the two-stage generation method, the index document is completely transparent, allowing users to identify and correct design problems in the first stage.
[0417] It is understandable that the index document is structured text containing tag encoding and semantic element information, rather than a natural language reasoning process. Moreover, the index document is fully human-readable, allowing for review and modification of the index content before the second stage of generation.
[0418] Optionally, indexed documents can be persistently stored and version-controlled for subsequent incremental development and content maintenance.
[0419] In the example above, the large model can first generate a structured index document corresponding to the user's actual needs. Based on this structured index document, a user-perceptible and understandable content format can be provided, allowing the large model to reflect the user's level of understanding of their actual needs. Furthermore, the user can modify the structured index document to further ensure the accuracy of the final target content.
[0420] Building upon the aforementioned embodiments, a two-stage generation process first generates a structured index document based on the user's requirements. The user can then modify this understandable and editable structured index document, and the large model can generate the target content based on the modified structured index document.
[0421] As can be seen from the foregoing embodiments, training data is required during the training and fine-tuning of a large model. To achieve better training results, a plan-priority training sample in the form of triples can be constructed.
[0422] In one example, the method further includes: constructing planning-priority training samples based on the requirements description, at least one version of the structured index document, and the target content, wherein the planning-priority training samples are used for supervised fine-tuning training of the large model; wherein the at least one version of the structured index document includes a structured index document generated based on the large model according to the requirements description, and / or a modified structured index document.
[0423] For example, the implementation provided in this example enables planning-first paradigm training during supervised fine-tuning training of large models.
[0424] Specifically, the user's input description of needs and target content can serve as the input and output of the planning-first training samples. The training data in the form of triples in the planning-first training samples also includes information about intermediate steps.
[0425] Specifically, at least one version of the structured index document can be used as information in the intermediate step to construct a planning-priority training sample in the form of triples.
[0426] Furthermore, since the large model first generates a first version of the structured index document based on the requirements description, during the two-stage generation process, the user can modify the first version of the structured index document generated by the large model to obtain the modified structured index document, i.e., the second version of the structured index document.
[0427] In one example, the first version of the structured index document can be used as information from an intermediate step to build a planning-priority training sample.
[0428] In another example, the second version of the structured index document can be used as information from an intermediate step to build the planning-priority training samples.
[0429] In another example, the first and second versions of the structured index documents can be combined as information in an intermediate step to construct a planning-priority training sample.
[0430] Based on the constructed planning-priority training samples, it is possible to perform supervised fine-tuning training on large models (which can be large language models).
[0431] It can be understood that the training data consists of triplets from the requirement description to the structured index document to the target content; before generating the target content, the large language model first generates a structured index that conforms to the index specification as an intermediate reasoning step; the intermediate reasoning step is a structured text that is human-readable, auditable, and editable, which is different from the invisible implicit reasoning process.
[0432] Furthermore, using both the first and second versions of the structured index documents as training data enables the large model to learn more accurately the details of the structured index documents in practical applications, thereby improving the accuracy of target content generation.
[0433] An example of a triplet-based planning-priority training sample is:
[0434] Input (Requirement Description): Develop a JWT authentication controller that supports four login methods: email, mobile phone number, third-party OAuth, and QR code scanning, and implements a dual-Token mechanism of access token and refresh token.
[0435] Intermediate steps (index entries): authController.js [CCA8RM]: F: JWT authentication control | R: authService, userModel, bcrypt | A: / api / auth / login, / api / auth / register | S: 4 login methods, dual token mechanism.
[0436] Output (target code): The complete source code of authController.js.
[0437] In the example above, by prioritizing training samples, training a large model enables it to learn to first plan and generate structured indexed documents before generating the target content. This indirectly improves the accuracy of the large model in generating the target content.
[0438] Based on any of the foregoing embodiments, in one example, the structured index document also includes global constraint information; the global constraint information is used to ensure that the target content conforms to the specification constraints indicated by the global constraint information during the process of generating target content based on the large model and the structured index document.
[0439] Among them, the normative constraints include at least one of the following: technical specification constraints, style specification constraints, compatibility constraints, and security constraints.
[0440] For example, structured index documents also include global constraint information. This global constraint information represents the canonical constraints that apply to all index entries in the structured index document.
[0441] Furthermore, in the process of generating target content based on a large model and structured index documents, the large model (which may be a large language model) can read global constraint information from the structured index documents and generate target content that conforms to the normative constraints indicated by the global constraint information.
[0442] Specifically, normative constraints include at least one of the following: technical specification constraints, style specification constraints, compatibility constraints, and security constraints.
[0443] Technical specification constraints refer to the constraints that must be followed when generating target content from a large model in the code domain. These include technical standards, architectural rules, and development paradigms used to constrain the target content (such as code files).
[0444] For example, technical specification constraints can include: technology stack constraints, UI (User Interface) framework constraints, and middleware pattern constraints.
[0445] Furthermore, technology stack constraints are used to limit the programming language, version, libraries, and tools that the code depends on in the code files. Specifically, they are used to prevent large models from generating code files that are not within the specified technology stack.
[0446] Furthermore, UI framework constraints are used to limit the UI component libraries, rendering frameworks, and layout specifications that code files must adhere to. Specifically, they ensure that the final user interface presented by the code files during the front-end development process is consistent, reusable, and conforms to the project framework.
[0447] Furthermore, middleware pattern constraints are used to define the specifications and design patterns of middleware applicable in data processing or communication services. Specifically, they ensure that code files conform to the system architecture and can connect to existing service chains.
[0448] Style specification constraints refer to the constraints that must be followed when a large model generates target content in the image domain. These include visual representation rules, color systems, and brand visual standards used to constrain the target content (such as the image to be generated).
[0449] For example, style guidelines can include color guidelines and brand visual standards.
[0450] Furthermore, color specification constraints are used to limit the color information that the generated image must use. These include, for example, the primary color, secondary colors, gradient rules, contrast, and color value range of the generated image. Specifically, they are used to ensure the tonal consistency of the generated image.
[0451] Furthermore, brand visual standard constraints are used to define the specifications of visual elements in the image to be generated. Taking the brand icon as an example, these constraints specifically define the brand icon's position, proportion, font, and rounded corner specifications in the image to be generated.
[0452] Compatibility constraints refer to the compatibility requirements for target content across any domain. For example, code files generated in the code domain should be compatible with different compilers or operating systems. Similarly, images generated in the image domain should be compatible with different image formats and resolutions.
[0453] Among these, security constraints refer to the security requirements for the target content. For example, medical knowledge documents generated in the medical field need to include drug contraindications to mitigate related risks.
[0454] In the example above, by introducing global constraint information into the structured index document, the target content generated by the large model can satisfy the normative constraints indicated by the global constraint information, thereby indirectly improving the accuracy of the generated target content.
[0455] Based on any of the foregoing embodiments, in one example, the method further includes:
[0456] In response to sharing requests from other AI interaction objects, the structured index document is sent to the other AI interaction objects so that they can reuse the structured index document to generate the target content.
[0457] For example, other AI interaction objects refer to model instances or sessions that are distinct from the aforementioned large model. These other model instances or sessions can generate shared requests to retrieve structured indexed documents, enabling them to be reused by other AI interaction objects.
[0458] For example, a first user has a pre-built structured index document. The first user inputs user instructions into the first large model, which can then generate the target content based on the structured index document.
[0459] A second user, who is also part of the development project with the first user, can initiate a sharing request through the second major model. The device where the first user is located responds to this sharing request by sending a structured index document to the device where the second user is located, enabling the second user to access the structured index document and, based on the second major model, reuse the structured index document to generate the target content.
[0460] It is understood that the content generation method based on indexed documents provided in this application embodiment, based on structured indexed documents, can be used across different large model instances and / or different sessions.
[0461] In the examples above, structured indexed documents in text format enable lossless transfer between different AI interaction objects. This allows for the generation of target content across models or sessions, improving project development efficiency.
[0462] The content generation method based on indexed documents provided in this application can select the operation direction after obtaining the structured indexed document, combining the included tag encoding and multiple semantic elements.
[0463] One operational direction is content generation. Content generation can include: code generation, image generation, document generation, and two-stage generation. Code generation includes: reproduction / incremental / migration; image generation includes: single frame / continuous / consistent; document generation includes: technical documents / reports; two-stage generation includes: requirements → indexing → content.
[0464] The content generation process includes the following steps:
[0465] Step G1: Index-driven content reproduction;
[0466] Step G2: Index-driven incremental development; specifically, it includes: requirements → understanding existing indexes → impact analysis → incremental indexes → incremental content;
[0467] Step G3: Index-driven cross-domain migration; specifically, it includes: source index → target index → target content;
[0468] Step G4: Two-stage generation; specifically, it includes: requirements → indexing (review) → content;
[0469] Step G5: Image generation; specifically, it includes: index entries + shared constraints → image.
[0470] One operation direction is agent scheduling. The agent scheduling operation includes the following steps:
[0471] Step C1: Read the six-region control index;
[0472] Step C2: Task decomposition and planning;
[0473] Step C3: Sub-agent scheduling;
[0474] Step C4: Result integration and return;
[0475] Step C5: Dynamic update of the central control index (including historical success rate feedback).
[0476] One of the operations is model training. Model training includes the following steps:
[0477] Step T1: Construct training sample pairs by pairing indexes and content;
[0478] Step T2: Importance-weighted differential loss function;
[0479] Step T3: Prioritize training by constructing triples based on requirements, indexes, and content;
[0480] Step T4: Index comparison and evaluation, including: reverse generation → comparison → scoring.
[0481] It is understood that the methods provided in the embodiments of this application can be applied to scenarios including but not limited to:
[0482] (1) Code reproduction, incremental development, or cross-technology stack migration based on code indexing;
[0483] (2) Image generation based on image index or continuous image consistency generation;
[0484] (3) Document generation or knowledge output based on multi-domain indexing;
[0485] (4) Task planning and scheduling of multi-agent systems based on central control index;
[0486] (5) Training on code model architecture understanding based on index-content aligned data;
[0487] (6) Code generation quality assessment based on index comparison.
[0488] For the above application scenario (1), developers generate code frameworks or incremental functional modules that conform to the relevant requirements indicated in the user instructions based on structured index documents. Alternatively, they can generate code files that conform to the technology stack migration indicated in the user instructions.
[0489] For the above application scenario (2), the user generates an image that meets the relevant requirements indicated in the user's instructions through a structured index document. Furthermore, in the process of generating multiple images, the consistency of multiple images is ensured by combining the shared constraint module.
[0490] For the above application scenario (3), based on the index entries in the indexed documents of different fields, such as the medical field or the legal field, it is possible to generate corresponding target content in different fields, such as medical knowledge documents or legal documents.
[0491] For the above application scenario (4), by using structured index documents as central control index documents, it is possible to realize task decomposition planning of multi-agent systems and schedule multi-agents to execute tasks, thereby improving task processing efficiency.
[0492] For the above application scenario (5), training data is obtained by constructing structured indexed documents and source content, which can be used to supervise and fine-tune the training of large models, further improve the understanding ability of large models, and improve the accuracy of target content generation.
[0493] For the above application scenario (6), taking the code domain as an example, the ability to understand large models is evaluated by comparing the index entries generated in reverse.
[0494] The content generation method based on indexed documents provided in this application, by acquiring structured indexed documents and utilizing the tag encoding and semantic elements of the index entries in the structured indexed documents, enables a large model to clearly and completely understand the attribute information and semantics of the source or target content. Upon receiving user instructions, the large model, in conjunction with the structured indexed documents, generates accurate target content. This solves the problem of insufficient expression of natural language instructions in complex tasks in traditional solutions.
[0495] By differentiating the types of related requirements indicated by user commands, differentiated target content generation logic is implemented for different needs. Specifically, in content reproduction scenarios, the large model ensures the consistency between the generated target content and the source content based on the tag encoding and semantic elements of the structured index document. In incremental development scenarios, new index entries are added, and the target content is generated collaboratively by combining the original structured index document and the new index entries to avoid compatibility conflicts. In cross-domain migration scenarios, the format conversion mechanism ensures that the generated new index entries conform to the format of the index entries in the domain where the target content is located. In summary, this improves the adaptability of the target content and covers more complex application requirements.
[0496] The shared constraint module enables attribute constraints on index entries in image-domain indexed documents. Combined with this module, the image generation model can ensure that the attributes of each image to be generated satisfy the attribute constraints indicated by the shared constraint module during the generation of multiple images. This improves the consistency of different images to be generated during the multi-image generation process.
[0497] By using a structured index document as the central control index document, intelligent task processing in multi-agent systems can be achieved, improving the efficiency of handling complex tasks. Combining the content of different partitions within the central control index document, it is possible to identify the functions of sub-agents, determine their workflows, identify available tools, and determine their communication methods. Finally, the master agent schedules the sub-agents to execute their assigned sub-tasks based on the central control index document, and then integrates these sub-tasks to obtain the final result of the user task.
[0498] Furthermore, when attributes in a multi-agent system change, it is not necessary to regenerate the entire central control index document. Instead, new index entries can be generated based on an incremental development model, and the central control index document can be updated accordingly. This allows for updates to the multi-agent system, reduces the amount of redevelopment required for system updates, and improves the efficiency of system updates.
[0499] By constructing training samples and performing supervised fine-tuning on a large model, continuous optimization of the model can be achieved, further improving the accuracy of target content generation. Specifically, by constructing training data that aligns index entries with source content, an architectural intent dimension is added to the training data. By pairing index entries with source content, the large model not only learns the attributes of the source content but also the correspondence between architectural intent and source content.
[0500] Furthermore, by using forward and backward training sample pairs, the large model can gain a comprehensive and bidirectional understanding of the relationship between index entries and source content during training, thereby improving the accuracy of the large model in generating target content during application.
[0501] Furthermore, by using the importance dimension encoded in the index entries, the contribution of different training samples to supervised fine-tuning of the large model can be adjusted. This differentiated training of the large model improves the accuracy of the target content generated by the trained model and accelerates the training fine-tuning process, thereby increasing the training efficiency of the large model.
[0502] The following section compares and explains different solutions with the solutions provided in the embodiments of this application.
[0503] (1) In related technologies, the target content (code file) is generated through a single-stage generation method. The single-stage generation mode from requirements to code is adopted. After the user inputs the requirement description, the large language model directly outputs the code. This mode performs well when handling single-file level tasks, but it has the following defects when handling multi-file level tasks: First, it lacks architectural planning. When the model generates the Nth file, it may ignore the interface conventions of the first N-1 files; Second, it cannot review architectural decisions. Users can only find design problems at the code level, and the correction cost is high; Third, it cannot reuse architectural knowledge. Every time a new system is generated, it starts from scratch.
[0504] The method provided in this application allows for the generation of target content at multiple stages, inserting a structured index as an explicit architecture planning layer between requirements and code. The index document ensures architectural consistency across files, allows for manual review of architectural decisions at the index level, and enables the index document to be reused across projects.
[0505] (2) In related technologies, the use of implicit thought chain technology enables large language models to perform internal reasoning before generating the final output. However, implicit thought chains have the following limitations: First, the reasoning process is not visible to the user, and the user cannot judge whether the model's planning is reasonable; second, the reasoning process is not editable, and the user cannot correct incorrect planning; third, the reasoning process is not persistent and cannot be used as the basis for subsequent incremental development; fourth, the reasoning format is uncertain, and the structure of each reasoning may be different.
[0506] The method provided in this application generates an explicit, structured, and persistent index document. Users can read the index to confirm the rationality of the architecture plan, edit the index to correct erroneous design decisions, and incorporate the index into version control as a project asset.
[0507] (3) In related technologies, multi-agent frameworks typically use code-level configuration to define the capabilities and workflows of agents. This approach has the following problems: First, the configuration is scattered across multiple code files, and the main agent cannot obtain the full picture of the system in a single inference; second, configuration modifications require redeployment, lacking the ability to dynamically update at runtime; third, the configuration format is bound to a specific framework, making cross-framework migration difficult; fourth, the configuration content is not transparent to humans, making it difficult to directly audit the cognitive content of the main agent.
[0508] The method provided in this application compresses all configuration information into a single human-readable text file in the central control index document. The main intelligent agent only needs to read this file to obtain global knowledge. The central control index document follows the principle of content unit independence and supports dynamic incremental updates. Furthermore, the index format is plain text and is not bound to any specific framework.
[0509] It should also be noted that existing multi-agent systems typically rely on dynamic registration centers or continuous network heartbeats to maintain system state, consuming significant network and computing resources. In contrast, the method provided in this application, through a static central control index document, allows the primary agent to obtain full system scheduling capabilities with only a single context load, avoiding communication delays and additional token consumption caused by multiple network interactions.
[0510] (4) In related technologies, during the training of large models, the training data mainly comes from open-source code repositories. This data only contains the code itself and lacks information about the architectural intent. The model learns the syntax patterns and local programming patterns of the code through this data, but lacks an understanding of the architectural layer information. For example, the role of files in the system, the business dependencies between files, and the differences in importance between different files.
[0511] The method provided in this application embodiment constructs training sample pairs by aligning indexed documents with corresponding source content, which can supplement the architectural intent dimension.
[0512] It should be noted that those skilled in the art will understand that the index-driven generation method described in this application is also applicable to scenarios that are used in conjunction with vector retrieval.
[0513] For example, when index entries in an indexed document contain pointer identifiers to a vector database, the content generation process can simultaneously refer to the schema information of the textual index and the detailed content fragments returned by the vector retrieval.
[0514] Example of a mixed-mode index entry: userService.js[SCA8M]:F: User Service Core|R: userModel|A: / api / user|S: CRUD Operations|VEC:vec_db_001#chunk_123.
[0515] Furthermore, the large model mentioned in the embodiments of this application is not limited to a specific large language model architecture. A large language model architecture can be a large language model based on the Transformer architecture. The large model can also be other artificial intelligence model architectures capable of processing structured text.
[0516] The methods provided in the embodiments of this application can be used for verification in different application scenarios.
[0517] One possible verification implementation scenario involves code generation in which two non-programmers independently develop a large system using an index-driven approach. Developer A completes 238,770 lines of production code, serving 4,427 users; Developer B completes 241,845 lines of production code.
[0518] In a cross-technology stack migration scenario, the backend of the AI teaching platform was migrated from Node.js to Go, involving approximately 82,000 lines of code refactoring, which took 3 to 4 days of spare time, and the developers had almost zero experience with the Go language.
[0519] One possible verification implementation scenario involves agent scheduling: Based on a central control index document, the master agent can gain a complete understanding of the entire multi-agent system from approximately 2,000 to 100,000 tokens of text, including the capability boundaries, tool constraints, and workflow rules of each sub-agent. Since the central control index document uses plain text format and adheres to the principle of content unit independence, adding a new sub-agent or tool only requires appending the corresponding index entry, without needing to regenerate the entire document.
[0520] One possible implementation for validation, in the model training scenario, involves pairing index entries with corresponding source code documents based on validated codebase index documents to construct index-content aligned training samples. The number of training samples corresponds to the number of index entries; more index entries result in richer training data. This method supplements existing code training data with an architectural intent dimension.
[0521] Figure 9 Schematic diagram of the content generation device based on indexed documents provided in this application Figure 1 ,like Figure 9 As shown, the content generation device 90 based on indexed documents provided in this embodiment includes:
[0522] The acquisition module 901 is used to acquire structured index documents; wherein, the structured index documents include multiple index entries, each index entry includes tag encoding and semantic element information; the tag encoding includes the encoding values of multiple tag dimensions, each tag dimension encoding value is used to indicate the attributes of the source content or target content in the tag dimension; the semantic element information includes multiple semantic elements, each semantic element is used to indicate the semantic features of the source content or target content;
[0523] The processing module 902 is used to respond to user input commands and generate target content based on a large model and structured indexed documents; wherein, the user command represents the relevant requirements for the target content to be generated.
[0524] In one possible implementation, in response to a user input command, based on a large model and according to the structured indexed document, the target content is generated, and the processing module 902 is used for:
[0525] If the user instruction indicates a requirement for content reproduction, then based on the large model, the target content is generated according to the attributes of the source content in the tag dimension indicated by each index entry in the structured index document, as well as the semantic features of the source content; and / or,
[0526] If the user instruction indicates that the requirement for the target content to be generated is incremental development, then based on the large model, new index entries are generated according to the user instruction and the structured index document; based on the large model, the target content is generated according to the new index entries; and / or,
[0527] If the user instruction indicates that the relevant requirement for the target content to be generated is cross-domain migration, then based on the large model, the structured index document is converted according to the user instruction to obtain the target format structured index document; based on the large model, the target content is generated according to the target format structured index document.
[0528] In one possible implementation, if the user instruction indicates that the requirement for the target content to be generated is incremental development, the processing module 902 is further configured to:
[0529] Based on the large model, modification suggestions are generated according to the structured index documents and the new index entries; the modification suggestions are the parts of the structured index documents that are affected by the new index entries.
[0530] In one possible implementation, the semantic element information in the structured index document is determined based on the domain of the source content corresponding to the structured index document;
[0531] When the domain of the source content is the code domain, the semantic elements in the semantic element information include: functional elements, related elements, interface elements, and descriptive elements;
[0532] When the source content is in the image domain, the semantic elements in the semantic element information include: subject elements, layout elements, aesthetic elements, symbolic elements, and output elements;
[0533] When the source content is in the medical field, the semantic elements in the semantic element information include: symptom elements, association elements, diagnostic elements, and treatment plan elements;
[0534] When the source content is in the legal field, the semantic elements in the semantic element information include: clause elements, citation elements, case law elements, and restriction elements.
[0535] In one possible implementation, when the source content is in the image domain, the target content is the image to be generated, and the large model is a multimodal image generation model.
[0536] Semantic elements in a structured index document are used to indicate at least one of the following: the main content, hierarchical layout, artistic style, symbolic meaning, and output specifications of the image to be generated.
[0537] In one possible implementation, when the domain of the source content is an image domain, the acquisition module 901 is further configured to acquire at least one shared constraint module; wherein, the shared constraint module is configured to define attribute constraints commonly referenced by multiple index entries; the attribute constraints include at least one of role constraints, style constraints, and scene constraints;
[0538] Based on the large model and the structured indexed documents, target content is generated. Processing module 902 is used for:
[0539] Based on a multimodal image generation model, multiple images to be generated are generated according to each index entry in a structured index document and at least one shared constraint module. The images to be generated correspond to the index entries.
[0540] In one possible implementation, the processing module 902 is further configured to:
[0541] The structured index document is used as the central control index document and input into the main intelligent agent; the main intelligent agent is used for task planning and sub-agent scheduling based on the central control index document.
[0542] In response to the main intelligent agent receiving the user task, the main intelligent agent determines the target sub-intelligent agent based on the sub-intelligent agent definition area in the central control index document; wherein, the sub-intelligent agent definition area includes index entries for indicating the professional domain, input and output specifications, calling interface and cooperation constraints of each sub-intelligent agent; the target sub-intelligent agent is the sub-intelligent agent that can solve the user task;
[0543] Based on the workflow configuration area in the central control index document, the main intelligent agent decomposes the user task into at least one subtask and determines the execution order and dependencies of each subtask. The workflow configuration area includes index entries for indicating task decomposition rules, execution order, branch conditions, state transitions, and exception handling.
[0544] Based on the tool registration area in the central control index document, the master agent determines the available tools and constraints of each sub-agent; the tool registration area includes index entries that indicate the functional description, parameter specifications, calling constraints and resource consumption of the available tools for each sub-agent.
[0545] The main intelligent agent schedules target sub-intelligent agents to execute sub-tasks, and performs message passing and state synchronization according to the communication protocol area in the central control index document; wherein, the communication protocol area includes index entries used to indicate semantic interaction protocols, state synchronization mechanisms, conflict resolution rules and permission inheritance relationships between intelligent agents;
[0546] The main agent receives the execution results from the target sub-agent and integrates them to obtain the final result corresponding to the user task.
[0547] In one possible implementation, the processing module 902 is further configured to perform at least one of the following:
[0548] When a new sub-agent is added, an index entry corresponding to the new sub-agent is added to the sub-agent definition area in the central control index document;
[0549] When a new available tool is added, an index entry corresponding to the new available tool is added to the tool registration area in the central control index document;
[0550] When a workflow changes, the index entries corresponding to the changed workflow are updated in the workflow configuration area of the central control index document.
[0551] In one possible implementation, the processing module 902 is further configured to:
[0552] Retrieve the source content corresponding to the structured indexed document;
[0553] Multiple training sample pairs are constructed based on the index entries in the structured index documents and the source content corresponding to the index entries;
[0554] Supervised fine-tuning training of a large model is performed based on multiple training sample pairs.
[0555] In one possible implementation, the multiple training sample pairs include forward training sample pairs and reverse training sample pairs.
[0556] In the forward training sample pairs, the index entries are used as training samples, and the source content corresponding to the index entries is used as the label value; in the reverse training sample pairs, the source content corresponding to the index entries is used as training samples, and the index entries are used as label values.
[0557] In one possible implementation, training sample pairs have weight values in the loss function, which indicate the contribution of the training samples to supervised fine-tuning of the large model. The weight values of the training sample pairs are positively correlated with the encoded values of the importance dimension in the label encoding of the index entries.
[0558] In one possible implementation, the processing module 902 is further configured to:
[0559] Input the target content into the large model to generate inverted index entries;
[0560] A consistency score is calculated based on the inverted index entries and the index entries in the structured index documents; the consistency score is used to characterize the degree of consistency between the inverted index entries and the index entries in the structured index documents.
[0561] In one possible implementation, the processing module 902 is further configured to:
[0562] Responding to user input of requirement descriptions, and based on a large model, generating structured indexed documents according to the requirement descriptions;
[0563] In response to user modifications to the structured index documents, target content is generated based on the modified structured index documents using a large model.
[0564] In one possible implementation, the processing module 902 is further configured to:
[0565] Based on the requirements description, at least one version of the structured index document, and the target content, a planning-priority training sample is constructed. The planning-priority training sample is used for supervised fine-tuning training of the large model. The at least one version of the structured index document includes the structured index document generated based on the large model according to the requirements description, and / or the modified structured index document.
[0566] In one possible implementation, the structured index document also includes global constraint information; the global constraint information is used to ensure that the target content conforms to the specification constraints indicated by the global constraint information during the process of generating target content based on the large model and the structured index document.
[0567] Among them, the normative constraints include at least one of the following: technical specification constraints, style specification constraints, compatibility constraints, and security constraints.
[0568] In one possible implementation, the processing module 902 is further configured to:
[0569] In response to sharing requests from other AI interaction objects, the structured index document is sent to the other AI interaction objects so that they can reuse the structured index document to generate the target content.
[0570] The content generation device based on indexed documents provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0571] It should be noted that the module division of the above-mentioned device can also be divided in other ways according to function. Figure 10 Schematic diagram of the content generation device based on indexed documents provided in this application Figure 2 ,like Figure 10 As shown, it includes: an index acquisition module, a content generation module, an agent scheduling module, and a training data construction module.
[0572] The inputs to the device include: structured index documents, user instructions, task requirements, and source content libraries (for training).
[0573] The index acquisition module is used to retrieve structured semantic index documents and parse the tag encoding and semantic feature information in the index documents. An index document contains multiple index entries, each containing tag encoding and semantic feature information.
[0574] The content generation module is used to generate target content that conforms to the index description based on the indexed documents and user instructions, using a large language model.
[0575] The agent scheduling module is used to enable the master agent to achieve unified cognitive control and task scheduling of sub-agents based on the central control index document.
[0576] The training data construction module is used to pair indexed documents with corresponding source content to construct training data for supervised fine-tuning of large language models.
[0577] Specifically, the content generation module includes:
[0578] The content reproduction submodule is used to generate complete content based on indexed documents.
[0579] The incremental development submodule is used to generate incremental indexes and incremental content based on existing indexes and incremental requirements, and to perform impact analysis to identify existing content units that need to be modified synchronously.
[0580] The cross-morphological migration submodule is used to convert the source morphological index into the target morphological index and generate the target content.
[0581] A two-stage generation submodule is used to first generate an index as an intermediate step in explicit reasoning, and then generate the content after review.
[0582] The consistency constraint submodule manages the shared constraint module, ensuring the consistency of generated content during continuous content generation.
[0583] Specifically, the agent scheduling module includes:
[0584] The central control index management submodule is used to manage central control index documents that contain six regions.
[0585] The dynamic update submodule is used to incrementally update the central control index document when a new sub-agent, tool, or workflow is added, and dynamically adjust the quality level label based on the historical execution success rate.
[0586] The task planning submodule is used by the main agent to decompose tasks and schedule sub-agents based on the central control index.
[0587] Specifically, the training data construction module includes:
[0588] The sample pairing submodule is used to pair index entries with corresponding source content to form training samples.
[0589] The importance weighting submodule is used to differentially weight training samples based on the importance labels in the index.
[0590] The evaluation submodule is used to assess the model's architectural understanding by generating an index in reverse and comparing it with a reference index.
[0591] The aforementioned device can invoke a large language model, understand the architecture based on indexed documents, and perform one or more of the following: content generation, execution scheduling, and construction of training data.
[0592] The device's outputs include: the generated target content, scheduling instructions and execution results, training dataset, and architecture consistency evaluation score.
[0593] In one possible implementation, a content generation module is used to generate target content that conforms to the index description based on the index document and user instructions, using a large language model. This module includes a content reproduction submodule, an incremental development submodule, a cross-format migration submodule, a two-stage generation submodule, and a consistency constraint submodule. The incremental development submodule includes an impact analysis function, identifying content units that need to be modified synchronously by reading the related elements of existing index entries. The consistency constraint submodule manages the shared constraint module, ensuring consistency of roles, styles, and scenarios during continuous content generation.
[0594] In one possible implementation, an agent scheduling module is used to achieve unified cognitive control of a multi-agent system based on a central control index document. This module includes a central control index management submodule, a dynamic update submodule, and a task planning submodule. The dynamic update submodule supports dynamically adjusting quality level labels based on the historical execution success rate of the sub-agents.
[0595] In one possible implementation, a training data construction module is used to pair indexed documents with corresponding source content to construct training data for supervised fine-tuning of a large language model. This module includes a sample pairing submodule, an importance weighting submodule, and an evaluation submodule. The evaluation submodule calculates an architecture consistency score by generating an index in reverse and comparing it with a reference index.
[0596] In one possible implementation, the core functions of the content generation module and the agent scheduling module are implemented through a large language model.
[0597] The content generation device based on indexed documents provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0598] Figure 11 A schematic diagram of the structure of the electronic device provided in this application. Figure 11As shown, the electronic device 110 provided in this embodiment includes at least one processor 1101 and a memory 1102. Optionally, the electronic device 110 further includes a communication component 1103. The processor 1101, the memory 1102, and the communication component 1103 are connected via a bus 1104.
[0599] In a specific implementation, at least one processor 1101 executes computer execution instructions stored in memory 1102, causing at least one processor 1101 to perform the above-described method.
[0600] It should be noted that there can be one or more processors 1101 and one or more memory units 1102. Furthermore, the processors 1101 and memory units 1102 can be integrated together or configured separately.
[0601] The specific implementation process of processor 1101 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0602] Optionally, the input for the electronic device provided in this embodiment includes: index documents + user instructions / training data.
[0603] Optionally, the output of the electronic device provided in this embodiment includes: generated content / scheduling results / training data / evaluation scores.
[0604] Optionally, the aforementioned memory stores computer-executed instructions, as well as index documents and training data.
[0605] Optionally, the processor executes computer instructions and runs the large language model or calls the application programming interface (API) of the large language model.
[0606] Optionally, the aforementioned communication components are used for network communication, as well as for calling the API services of the large language model and communicating with sub-agents.
[0607] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0608] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0609] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0610] For example, the electronic device can be a terminal device or a server. The terminal device may include, but is not limited to, mobile terminals such as laptops and fixed terminals such as desktop computers.
[0611] for Figure 10 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0612] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0613] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0614] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0615] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0616] In particular, according to the method embodiments provided in this application, the process shown in the accompanying drawings can be implemented as a computer software program.
[0617] For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart.
[0618] In the above examples, the computer program product can be downloaded and installed from a network via a communication component in an electronic device, or installed from a memory, or installed from a ROM. When the computer program product is executed by a processor, it performs the functions defined in the methods of the embodiments of this disclosure.
[0619] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0620] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0621] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0622] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0623] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0624] Finally, it should be noted that those skilled in the art, upon considering the specification and practicing the application disclosed herein, will readily conceive of other embodiments of this application. The scope of disclosure herein is not limited to technical solutions formed by specific combinations of the above-described technical features, but also includes other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0625] This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed in this application. It is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and alterations can be made without departing from its scope. The scope of this application is limited only by the appended claims.
[0626] Furthermore, the target content in the medical or legal fields generated by this application is essentially a structured reorganization and information generation of the source data. It is provided to users as the result of information processing only and is not intended as a diagnosis or treatment method or a basis for legal judgment.
Claims
1. A content generation method based on indexed documents, characterized in that, include: Obtain a structured index document; wherein the structured index document includes multiple index entries, each index entry includes tag encoding and semantic element information; the tag encoding includes encoding values for multiple tag dimensions, each encoding value for a tag dimension is used to indicate the attribute of the source content or target content in that tag dimension; the semantic element information includes multiple semantic elements, each semantic element is used to indicate the semantic features of the source content or target content; In response to user input commands, target content is generated based on the large model and the structured indexed document; wherein the user commands represent the relevant requirements for the target content to be generated.
2. The method according to claim 1, characterized in that, In response to user input commands, based on the large model and the structured indexed documents, target content is generated, including: If the user instruction represents a requirement for content reproduction of the target content to be generated, then based on the large model, according to the attributes of the source content in the tag dimension indicated by each index entry in the structured index document, and the semantic features of the source content, the target content is generated; and / or, If the user instruction indicates that the requirement for the target content to be generated is incremental development, then based on the large model, according to the user instruction and the structured index document, a new index entry is generated; based on the large model, according to the new index entry, the target content is generated; and / or, If the user instruction indicates that the relevant requirement for the target content to be generated is cross-domain migration, then based on the large model, the structured index document is format-converted according to the user instruction to obtain a structured index document in the target format; based on the large model, the target content is generated according to the structured index document in the target format.
3. The method according to claim 2, characterized in that, If the user instruction indicates that the requirement for the target content to be generated is incremental development, the method further includes: Based on the large model, modification suggestions are generated according to the structured index document and the new index entry; wherein, the modification suggestions are modification suggestions for the parts of the structured index document that are affected by the new index entry.
4. The method according to claim 1, characterized in that, The semantic element information in the structured index document is determined based on the domain of the source content corresponding to the structured index document; When the domain of the source content is the code domain, the semantic elements in the semantic element information include: functional elements, related elements, interface elements, and descriptive elements; When the domain of the source content is the image domain, the semantic elements in the semantic element information include: subject elements, layout elements, aesthetic elements, symbolic elements, and output elements; When the source content is in the medical field, the semantic elements in the semantic element information include: symptom elements, association elements, diagnostic elements, and treatment plan elements; When the source content is in the legal field, the semantic elements in the semantic element information include: clause elements, citation elements, case law elements, and restriction elements.
5. The method according to claim 4, characterized in that, When the source content is in the image domain, the target content is the image to be generated, and the large model is a multimodal image generation model; The semantic elements in the structured index document are used to indicate at least one of the following: the main content, hierarchical layout, artistic style, symbolic meaning, and output specifications of the image to be generated.
6. The method according to claim 5, characterized in that, When the domain of the source content is an image domain, the method further includes: Obtain at least one shared constraint module; wherein, the shared constraint module is used to define attribute constraints that are commonly referenced by multiple index entries; the attribute constraints include at least one of role constraints, style constraints, and scene constraints; The process of generating target content based on the large model and the structured indexed documents includes: Based on the multimodal image generation model, multiple images to be generated are generated according to each index entry in the structured index document and the at least one shared constraint module, and the images to be generated correspond to the index entries.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: The structured index document is input into the master agent as the central control index document; wherein, the master agent is used to perform task planning and sub-agent scheduling based on the central control index document; In response to the main intelligent agent receiving a user task, the main intelligent agent determines a target sub-intelligent agent based on the sub-intelligent agent definition area in the central control index document; wherein, the sub-intelligent agent definition area includes index entries for indicating the professional domain, input and output specifications, calling interfaces and cooperation constraints of each sub-intelligent agent; the target sub-intelligent agent is a sub-intelligent agent that can solve the user task; Based on the workflow configuration area in the central control index document, the main intelligent agent decomposes the user task into at least one subtask and determines the execution order and dependencies of each subtask; wherein, the workflow configuration area includes index entries for indicating task decomposition rules, execution order, branch conditions, state transitions and exception handling. Based on the tool registration area in the central control index document, the main intelligent agent determines the available tools and constraints of each sub-intelligent agent; wherein, the tool registration area includes index entries for indicating the functional description, parameter specifications, calling constraints and resource consumption of the available tools of each sub-intelligent agent; The main intelligent agent schedules the target sub-intelligent agent to execute the sub-task, and performs message passing and state synchronization according to the communication protocol area in the central control index document; wherein, the communication protocol area includes index entries for indicating semantic interaction protocols, state synchronization mechanisms, conflict resolution rules and permission inheritance relationships between intelligent agents; The main intelligent agent receives the execution results of the target sub-intelligent agent and integrates them to obtain the final result corresponding to the user task.
8. The method according to claim 7, characterized in that, The method further includes at least one of the following: When a new sub-agent is added, an index entry corresponding to the new sub-agent is added to the sub-agent definition area in the central control index document; When a new available tool is added, an index entry corresponding to the new available tool is added to the tool registration area in the central control index document; When a workflow changes, the index entries corresponding to the changed workflow are updated in the workflow configuration area of the central control index document.
9. The method according to any one of claims 1-6, characterized in that, The method further includes: Obtain the source content corresponding to the structured index document; Multiple training sample pairs are constructed based on the index entries in the structured index document and the source content corresponding to the index entries; Based on the multiple training sample pairs, the large model is subjected to supervised fine-tuning training.
10. The method according to claim 9, characterized in that, The plurality of training sample pairs includes forward training sample pairs and reverse training sample pairs; In the forward training sample pair, the index entry is used as the training sample, and the source content corresponding to the index entry is used as the label value; in the reverse training sample pair, the source content corresponding to the index entry is used as the training sample, and the index entry is used as the label value.
11. The method according to claim 9, characterized in that, The training sample pairs have weight values in the loss function, which indicate the contribution of the training samples to supervised fine-tuning of the large model. The weight values of the training sample pairs are positively correlated with the encoded values of the importance dimension in the label encoding of the index entries.
12. The method according to any one of claims 1-6, characterized in that, The method further includes: The target content is input into the large model to generate inverted index entries; A consistency score is calculated based on the inverted index entries and the index entries in the structured index document; wherein the consistency score is used to characterize the degree of consistency between the inverted index entries and the index entries in the structured index document.
13. The method according to any one of claims 1-6, characterized in that, The method further includes: In response to the user's input of a requirement description, a structured index document is generated based on the large model and the requirement description; In response to user modifications to the structured index document, target content is generated based on the modified structured index document according to the large model.
14. The method according to claim 13, characterized in that, The method further includes: Based on the requirements description, at least one version of the structured index document, and the target content, a planning-priority training sample is constructed, which is used for supervised fine-tuning training of the large model; wherein, the at least one version of the structured index document includes a structured index document generated based on the large model according to the requirements description, and / or the modified structured index document.
15. The method according to any one of claims 1-6, characterized in that, The structured index document also includes global constraint information; the global constraint information is used to ensure that the target content conforms to the specification constraints indicated by the global constraint information during the process of generating target content based on the large model and the structured index document. The specified constraints include at least one of the following: technical specification constraints, style specification constraints, compatibility constraints, and security constraints.
16. The method according to any one of claims 1-6, characterized in that, The method further includes: In response to a sharing request from another AI interaction object, the structured index document is sent to the other AI interaction object so that the other AI interaction object can reuse the structured index document to generate the target content.
17. A content generation device based on indexed documents, characterized in that, include: An acquisition module is used to acquire a structured index document; wherein the structured index document includes multiple index entries, each index entry includes tag encoding and semantic element information; the tag encoding includes encoding values of multiple tag dimensions, each encoding value of a tag dimension is used to indicate the attribute of the source content or target content in the tag dimension; the semantic element information includes multiple semantic elements, each semantic element is used to indicate the semantic features of the source content or target content; The processing module is used to respond to user input commands and generate target content based on the large model and the structured index document; wherein the user command represents the relevant requirements for the target content to be generated.
18. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-16.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-16.
20. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-16.