Intelligent agent automatic configuration method and system based on large model, knowledge base and tool
By collaboratively optimizing the inference model, Embedding model and reordering model in the automatic configuration system of the agent, the problem of waste of computing resources and insufficient accuracy of search results in high-dimensional data processing is solved, and more efficient and accurate data retrieval and processing is achieved.
Patent Information
- Application Number
- CN202510134433.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-07
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2045-02-07
AI Technical Summary
The prior art is prone to waste of computing resources and insufficient retrieval result accuracy when processing high-dimensional data, especially in complex data scenarios such as knowledge base Q&A.
The automatic configuration method of agents based on large models, knowledge bases and tools is adopted to optimize the data processing process through collaborative optimization of inference model, Embedding model and reordering model, ensuring efficient data flow between models and reducing waste of computing resources.
It significantly improves the retrieval accuracy and efficiency, is suitable for knowledge base Q&A and complex data processing scenarios, solves the problem of input and output mismatch between models, and reduces the waste of computing resources caused by feature redundancy and unbalanced distribution.
Smart Images

Figure CN119578559A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of large model data processing, and in particular to an intelligent agent automatic configuration method and system based on a large model, a knowledge base and a tool. Background Art
[0002] With the rapid development of big data and artificial intelligence technology, intelligent question-answering systems and complex task processing systems based on knowledge bases have been widely used in many fields, such as technical document retrieval, knowledge question-answering, intelligent decision support, etc. However, in existing technologies, the automatic configuration of intelligent agents and multi-model collaborative processing still face many challenges: In the multi-stage processing of task parsing, semantic retrieval, and result optimization, the input and output formats of different models often do not match. For example, the task results generated by the inference model are not suitable for the vectorization requirements of the Embedding model, and the retrieval results of the Embedding model may also affect the performance of the reranking model.
[0003] When processing high-dimensional data, existing solutions are prone to waste of computing resources due to feature redundancy and inefficient optimization, especially in complex data scenarios (such as knowledge base question and answer).
[0004] For example, a Chinese patent application with publication number CN118819617A discloses a configuration method and device for a large model application intelligent agent, the method comprising receiving an intelligent agent configuration instruction; and the intelligent agent configuration instruction is obtained based on a web front-end configuration; configuring corresponding intelligent agent metadata information according to the intelligent agent configuration instruction, and storing it in a metadata service; and the intelligent agent metadata information includes knowledge base metadata information, plug-in metadata information, workflow metadata information, and database metadata information; calling a large model intelligent agent service to create an intelligent agent framework, and binding the intelligent agent metadata information to the intelligent agent framework to create an intelligent agent. This prior art can greatly reduce the difficulty of developing an intelligent agent during the configuration process through a web visual configuration mechanism, shielding the underlying large language model, knowledge base and other technologies, so that business personnel who do not understand technology can also easily develop intelligent agents.
[0005] The above existing technologies all have the problems raised by this background technology: when processing high-dimensional data, it is easy to waste computing resources and insufficient retrieval result accuracy. To solve the above problems, this application designs an automatic configuration method and system for intelligent agents based on large models, knowledge bases and tools. Summary of the invention
[0006] The technical problem to be solved by the present invention is to address the deficiencies of the prior art, and to provide an intelligent agent automatic configuration method and system based on a large model, knowledge base and tools, obtain training data, input natural language into the reasoning model to generate a query task set, and after optimization, input the Embedding model to generate a preliminary retrieval result set; input the optimization result into the re-ranking model to generate the final retrieval result; when the training conditions are met, the reasoning model, the Embedding model and the re-ranking model are encapsulated as an intelligent agent. The system consists of a reasoning model configuration module, a retrieval model configuration module and a re-ranking model configuration module, which collaboratively realize task parsing, semantic retrieval and result optimization. The present invention improves retrieval accuracy and efficiency, and is suitable for knowledge base question and answer and complex data processing scenarios.
[0007] To achieve the above object, the present invention provides the following technical solutions: An agent automatic configuration method based on a large model, a knowledge base and a tool, the method comprising: Acquire training data, wherein the training data includes natural language content input by multiple users; Input each natural language content into a preset reasoning model, and fix the output of the reasoning model to a manually annotated query task set; Inputting the manually annotated query task set into a preset Embedding model, wherein the Embedding model is configured to call a preset knowledge base, and fixing the output of the Embedding model to the manually annotated preliminary search result set; Inputting the manually annotated preliminary search result set into a preset re-ranking model, and fixing the output of the re-ranking model to the manually annotated optimized search result; After the training reaches a set number of times, or the similarity between the test result and the manually annotated optimized retrieval result is higher than the set similarity threshold, the final reasoning model, the Embedding model and the re-ranking model are encapsulated as an intelligent agent.
[0008] The step of fixing the output of the inference model to a manually labeled query task set further includes: Generate an inference output, wherein the inference output is a preliminary query task set; Calculating the semantic similarity between the inference output and the manually annotated query task set, and optimizing the parameters of the inference model through iterative training according to the semantic similarity, so that the output of the inference model gradually approaches the manually annotated query task set until the semantic similarity reaches a set semantic threshold; The optimized inference model is used for subsequent packaging.
[0009] The method of fixing the output of the Embedding model to a manually annotated preliminary search result set further includes: Generate a semantic vector representation corresponding to each query task, and perform vector retrieval in the preset knowledge base to recall preliminary retrieval results related to the semantics of the query task; Calculate the search coverage between the preliminary search results and the manually annotated preliminary search result set, and update the semantic vector generation method of the Embedding model through rule optimization constraints according to the search coverage; When the retrieval result set of the Embedding model and the manually annotated preliminary retrieval result set reach a set retrieval threshold in terms of retrieval coverage, the optimization training is terminated and the optimized Embedding model is used for subsequent packaging.
[0010] Before inputting the manually annotated query task set into the preset Embedding model, the method further includes: Optimize the semantic structure of the output of the reasoning model; According to the query task after the semantic structure optimization, the semantic content of the query task is divided into high-frequency features and low-frequency features, and dynamic weights are assigned to different frequency features according to the vectorization requirements of the Embedding model to generate an input feature set; According to the input feature set, a specific format for the Embedding model input requirement is generated through the input converter.
[0011] The semantic structure optimization includes: Decomposing the query task into fine-grained subtasks according to semantic parsing rules, wherein the subtasks include key semantic units and attribute descriptions; Through the context information completion algorithm, context information related to the semantics of the preset knowledge base is added to the fine-grained subtask to update the query task.
[0012] Before inputting the manually annotated preliminary search result set into the preset re-ranking model, the method further includes: Extract multidimensional features from each search item in the preliminary search result set, calculate the feature distribution balance of the search items based on the multidimensional features, map the search items whose feature distribution balance is lower than the distribution threshold to an independent search space, and delete the corresponding search items from the preliminary search result set; Adjusting the feature density of the preliminary search result set according to the feature distribution balance; In the independent retrieval space, the retrieval items are reconstructed by a feature compression algorithm to generate a low-dimensional feature representation, which can be adapted to the ranking format of the re-ranking model.
[0013] The feature density adjustment includes: Calculate the feature distribution matrix according to the feature distribution balance of the search items in the preliminary search result set; According to the feature distribution matrix, the feature collaborative information amount of different search items in the preliminary search result set is calculated, and the density of the preliminary search result set is adjusted according to the feature collaborative information amount.
[0014] The step of fixing the output of the re-ranking model to the manually annotated optimized search result further includes: Constructing a feature mapping matrix of the low-dimensional feature representation; Performing auxiliary processing on the sorting process of the re-sorting model according to the feature mapping matrix; The optimization process of the reordering model is fused according to the feature mapping matrix.
[0015] The method further comprises: According to the real-time query tasks input by users, the corresponding query requirements are generated through the reasoning model in the intelligent agent; Input the query requirements into the embedding model of the intelligent agent, retrieve relevant knowledge base content and generate preliminary search results; Optimizing the preliminary search results through a re-ranking model in the agent to generate a ranked search result set; When the semantic relevance of the retrieval result set is lower than the result threshold, the reasoning model is recalled to regenerate the query requirement by analyzing the semantic distribution of the retrieval result set and the user input.
[0016] An agent automatic configuration system based on a large model, a knowledge base and tools, the system comprising a reasoning model configuration module, a retrieval model configuration module and a re-ranking model configuration module; The inference model configuration module is used to receive the natural language content input by the user, parse it into a structured query task, and optimize the output of the inference model according to the manually annotated query task set so that it gradually matches the manually annotated query task set; The retrieval model configuration module is used to vectorize the structured query task using the Embedding model, search the preset knowledge base and generate a preliminary retrieval result set, and perform feature optimization and density adjustment on the preliminary retrieval result set; The re-ranking model configuration module is used to perform a ranking logic process on the optimized preliminary search result set, and adjust the ranking weight in combination with the feature mapping matrix to generate a final search result set that is consistent with the manually labeled optimization result.
[0017] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention solves the problem of input-output incompatibility between models through the collaborative optimization of the inference model, the embedding model and the re-ranking model, and significantly improves the data processing efficiency and the accuracy of the retrieval results; 2. The present invention ensures efficient data flow between models by performing structured optimization and feature adaptation on the output during model training, while reducing the waste of computing resources caused by feature redundancy and uneven distribution. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 It is a flowchart of an agent automatic configuration method based on a large model, a knowledge base and a tool according to Embodiment 1 of the present invention; Figure 2 This is a data flow diagram of agent training in Example 1 of the present invention; Figure 3 This is a module diagram of the intelligent agent automatic configuration system based on a large model, knowledge base and tools according to Example 2 of the present invention. DETAILED DESCRIPTION
[0019] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0020] Example 1
[0021] See also Figure 1 The present invention provides an embodiment: an agent automatic configuration method based on a large model, a knowledge base and a tool, wherein the method comprises the following specific steps: S1: Get training data; In this step, users’ natural language content is collected from a variety of sources as training data. Data sources may include interaction logs, FAQs, and domain-specific corpora, etc. The collected data is preprocessed, including data cleaning, deduplication, and completion of missing information. Finally, the data is classified and labeled according to task requirements to support subsequent model optimization for specific scenarios.
[0022] S2: Input the training data into the preset inference model, output the query task set, and optimize the query task set; In this step, the preset reasoning model is the core of the intelligent agent, responsible for parsing the user's natural language input and generating structured query tasks. The model can identify the intent, keywords and context logic in the user input, and complete preliminary task decomposition and semantic optimization; Furthermore, the kernel of the inference model can adopt large language models such as OpenAI and GPT-4; Specifically, through natural language processing technology, the user's natural language input is converted into structured query tasks. Based on rule-based semantic verification and parsing algorithms, the generated tasks are checked for semantic consistency to ensure the clarity and operability of the tasks. The user's historical interaction data and current input are combined to generate more context-adaptive query tasks.
[0023] S3: Input the query task set into the preset Embedding model, output the preliminary search result set, and optimize the preliminary search result set; In this step, the preset Embedding model serves as the core module of the agent's semantic mapping, responsible for converting query tasks and knowledge base content into high-dimensional vector representations to support efficient semantic retrieval. By capturing the deep semantic relationship between texts, the Embedding model achieves accurate matching of user queries and knowledge base content; Furthermore, the content of the Embedding model can use the Embedding API, Text EmbeddingInference, etc. to capture semantic features through the trained vectorized mapping model. The preset model supports multi-language mode and is suitable for knowledge base content in Chinese, English or multiple languages. Specifically, the Embedding model is generally used in knowledge base question answering to match user queries with relevant document fragments, for example, to help retrieve paragraphs in technical documents that are relevant to the user's questions. The Embedding model preprocesses the query task, which includes content segmentation, dividing by sentences or text blocks to adapt to the limitations of the model context window, converting the query task into a semantic vector representation, and preprocessing the knowledge base content into a high-dimensional vector. The semantic similarity between the user query vector and the knowledge base text vector is calculated through a vector similarity algorithm (such as cosine similarity), and a threshold is set to filter the results to ensure that the recalled document fragments are highly relevant to the query task.
[0024] S4: inputting the preliminary search result set into a preset re-ranking model and outputting the optimized search result; In this step, the re-ranking model, as an optimization module of the intelligent agent, performs logical sorting on the preliminary search result set generated by the Embedding model. By evaluating the relevance, importance, and contextual synergy of the results, the re-ranking model ensures that the final search results are closer to user needs.
[0025] Furthermore, the reranking model can adopt the Rerank model (such as the reranking module in Text Embedding Inference) to optimize the sorting logic based on deep learning technology. The model reprocesses the features of the preliminary retrieval results and generates optimized sorting results based on semantic relevance and contextual importance.
[0026] Specifically, the preset reranking model is used for search engine result optimization, intelligent question-answering system and knowledge base relevance ranking. For example, when the user inputs the query task "How to read CSV file in Python?", the agent needs to retrieve relevant content from the technical document library and sort it by priority to ensure that the user can quickly obtain the most useful information.
[0027] S5: After the training reaches a set number of times, or the similarity between the test result and the manually annotated optimized retrieval result is higher than a set similarity threshold, the final reasoning model, the Embedding model and the re-ranking model are encapsulated as an intelligent agent; The threshold is selected based on experiments and actual business needs, such as being set at 90%.
[0028] See also Figure 2 , the data flow diagram of the intelligent agent training in the embodiment of the present invention, further, in this embodiment, mainly through training a large language model, through the coupling between models, the inference model, the Embedding model and the reordering model are deeply coupled to build an efficient and accurate intelligent agent. During the training process, by fixing the manually labeled output, the goal of the model at each stage is clarified, which provides a reliable comparison benchmark for the model parameter optimization and performance improvement.
[0029] Specifically, in the training of the inference model, the manually annotated query task set is used as the target output to guide the query tasks generated by the model to gradually approach the real semantic requirements. This process can effectively reduce the ambiguity and redundant information in the generated query tasks and improve the semantic parsing ability of the model. In the training of the Embedding model, the manually annotated preliminary retrieval result set is fixed to ensure that the retrieval coverage and matching accuracy meet the business requirements. At the same time, by optimizing the vectorized representation, the model's ability to handle complex semantic relationships in high-dimensional vector space is improved. In the training of the re-ranking model, the manually annotated optimized retrieval result set is used to guide the optimization of the sorting logic, ensuring that the sorting of the output results is consistent with user expectations and enhancing the model's adaptability to actual application scenarios.
[0030] Furthermore, through modular design and coupled optimization, efficient collaboration between reasoning, retrieval and ranking models is achieved, which significantly reduces redundant operations in the calculation process of a single model and optimizes the utilization of computing resources. In addition, during the training process, there will be problems in the model training that the input and output of different modules are not compatible. Additional processing of the output of each stage can optimize the overall system performance, especially reducing computing loss in complex data processing scenarios.
[0031] Specifically, the output of the inference model is optimized to enhance its structure and semantic clarity, ensuring that the generated tasks have clear vectorization requirements when input into the Embedding model; and the preliminary retrieval result set generated by the Embedding model also needs to optimize its feature distribution through feature extraction, denoising and density adjustment, so as to reduce feature dimension redundancy and reduce computing resource consumption when input into the re-ranking model. In addition, the re-ranking model further executes the sorting logic based on the optimized retrieval results to ensure that the final output results are highly consistent with the manually annotated target set. This processing method is not only suitable for scenarios with limited computer resources, effectively reducing model computing loss and memory usage, but also improves training efficiency and shortens training time; at the same time, it ensures that the output of each model is efficiently transmitted and adapted to the input of the next model, forming an efficient collaborative workflow from task generation to retrieval sorting. This multi-stage optimization and training method is particularly suitable for highly complex intelligent application scenarios such as large-scale knowledge base question answering and technical document retrieval.
[0032] The specific steps of S2 are as follows: S2.1: Input the cleaned and annotated training data (including the natural language content input by the user and its corresponding manually annotated query task set) into the inference model; In this embodiment, the training data is the basis of model optimization and is cleaned and labeled to ensure its quality. Unprocessed data may contain noise, redundant or inconsistent information, which will reduce model performance. A set of manually labeled query tasks is used as a high-quality supervisory signal to guide the inference model to generate highly adaptable query tasks.
[0033] Specifically, data cleaning is used to remove duplicate or invalid data (such as garbled characters, stop words, etc.) to improve the validity and consistency of the data. Through manual labeling, natural language input is aligned with standardized query tasks to form a training set for supervised learning. The cleaned and labeled data is used as input and input into the inference model through batch loading and block processing.
[0034] S2.2: Convert user input into a structured query task through natural language processing technology, and generate reasoning output, where the reasoning output is a preliminary query task set; Natural language input is usually unstructured, and direct use will make it difficult for subsequent models (such as Embedding models) to process. Converting natural language into structured query tasks can provide standardized input for downstream models.
[0035] Specifically, the inference model performs word segmentation, entity recognition, and intent analysis on user input to extract key elements, including goals, constraints, and context information. Then, according to the predefined template, the parsed key elements are organized into a structured query task set, including clear task goals, condition constraints, and supplementary information.
[0036] S2.3: Calculate the semantic similarity between the inference output and the manually annotated query task set, and optimize the parameters of the inference model through iterative training according to the semantic similarity, so that the output of the inference model gradually approaches the manually annotated query task set until the semantic similarity reaches a set semantic threshold; The initial output of the inference model may deviate from the set of manually annotated query tasks, and it is necessary to continuously optimize the model parameters through supervised learning so that the output it generates gradually approaches the manually annotated target. As an evaluation indicator, semantic similarity can quantify the gap between the model output and the manual annotation, providing feedback for iterative training.
[0037] Specifically, the semantic similarity between the two is calculated through cosine similarity, and the loss function is defined. The similarity difference is used as the optimization target. Then, according to the similarity, the parameters of the inference model are adjusted through the gradient descent algorithm to narrow the semantic gap between the model output and the manual annotation. The training and evaluation process is repeated to gradually improve the semantic consistency of the model output. When the similarity reaches the set threshold, the training is stopped.
[0038] S2.4: Record the optimized inference model and process the output of the inference model; The optimized inference model needs to be saved in the final version to facilitate subsequent packaging for use as an intelligent agent. Additional processing of the inference model output is performed to address possible missing details or incompatibility with downstream Embedding model inputs.
[0039] The specific steps of S2.4 are as follows: S2.4.1: Decompose the query task into fine-grained subtasks according to the semantic parsing rules, wherein the subtasks include key semantic units and attribute descriptions; The query task may contain multiple intents or complex semantic structures, and directly inputting them into the subsequent model may cause information conflicts or incompatibility. Decomposing the query task into fine-grained subtasks helps to extract the core semantics, clarify the attributes and goals of the task, and provide clear input for downstream modules; Specifically, the logical structure of the query task is parsed through the preset semantic parsing rule base, where the rule base includes common grammatical patterns (such as "target-constraints-context") and domain-specific semantic templates. The semantic parsing algorithm is used to split the query task into subtasks. Each subtask consists of a key semantic unit (such as "reading a CSV file") and an attribute description (such as "using Python"), breaking down complex tasks into easy-to-handle subtasks to improve the parsing efficiency of subsequent models.
[0040] S2.4.2: adding context information related to the semantics of the preset knowledge base to the fine-grained subtask through a context information completion algorithm, and updating the query task; Fine-grained subtasks usually only contain core semantic units and basic attribute descriptions, while ignoring context-related information (such as domain knowledge or background constraints), resulting in incomplete semantic information. Completing contextual information can enhance the semantic integrity of the task and its adaptability to subsequent retrieval tasks.
[0041] Specifically, the most relevant background knowledge is selected from the preset knowledge base based on semantic similarity, contextual information related to the subtask is extracted, the extracted contextual information is merged with the fine-grained subtask, and a weighted fusion method is used to ensure that the priority of the background information does not cover the core semantics of the subtask, thereby improving the semantic integrity and expressiveness of the query task. At the same time, it is verified whether the completed task meets the intention of the original query task, and contextual information that may cause ambiguity or conflict is removed. This improves the depth of understanding of the Embedding model for the query task during vectorization, and reduces the decline in retrieval accuracy caused by semantic loss.
[0042] S2.4.3: Based on the query task after semantic structure optimization, the semantic content of the query task is divided into high-frequency features and low-frequency features, and dynamic weights are assigned to different frequency features according to the vectorization requirements of the Embedding model to generate an input feature set; Different semantic features of query tasks have different effects on the vectorization of the Embedding model. High-frequency features usually represent the main goal of the task, while low-frequency features may contain important but insignificant auxiliary information. By assigning dynamic weights, the expressive power of vectorization can be effectively enhanced.
[0043] Specifically, through the feature frequency analysis algorithm, high-frequency features and low-frequency features in the query task are extracted. High-frequency features (such as "read CSV") reflect the core semantics of the task, and low-frequency features (such as "memory optimization") supplement background information. The feature weights are adjusted according to the frequency of the features and the needs of the Embedding model. High-frequency features are given higher weights to ensure that the model focuses on the core tasks. The weights of low-frequency features are dynamically adjusted according to their semantic importance to avoid losing key information and reduce the computational burden of the Embedding model when processing low-correlation features. The feature sets after dynamic weighting are combined into a unified input format to adapt to the processing requirements of the Embedding model, improve the accuracy of the vectorized results, and enhance the ability to express the core goals of the query task.
[0044] The calculation formula of dynamic weight is: , in, Representation characteristics The dynamic weight of represents the semantic similarity function, Representation characteristics Semantic similarity with the current context, represents the semantic frequency normalization function, Representation characteristics The semantic frequency normalized value of The correlation function representing the vectorization requirement, Representation characteristics The value associated with the vectorization requirement, represents the nonlinear attenuation parameter, which is used to control the sensitivity to the adaptation score to smooth the weight distribution, j represents other single features, and n represents the total number of other features; Among them, the characteristics The formula for the correlation function with the vectorization requirement is: , in, represents the rank of the matrix to be solved, Representation characteristics The rank of the matrix after spatial projection is, represents matrix multiplication, The vector matrix representing the projection of the feature semantic space, Represents the projection matrix of the vectorization requirement space of the Embedding model. The number of rows of the projection matrix is equal to the number of columns of the vector matrix. Represents the cosine similarity calculation function, The reference center vector representing the vectorization requirements of the Embedding model. Representation characteristics and the reference center vector The cosine similarity of Among them, the characteristics The calculation formula of the semantic frequency normalization function is: , in, represents the logarithm with base 2, Representation characteristics The frequency, represents the transposed matrix, The vector matrix representing the overall semantic space projection of the query task, Represents a constant greater than zero.
[0045] S2.4.4: Based on the input feature set, a specific format for the Embedding model input requirements is generated through an input converter.
[0046] The specific steps of S3 are as follows: S3.1: Generate a semantic vector representation corresponding to each query task, and perform vector retrieval in the preset knowledge base to recall preliminary retrieval results related to the semantics of the query task, with the purpose of efficiently retrieving content related to the semantics of the query task from a large number of documents; The core function of the Embedding model is to convert unstructured natural language data into high-dimensional vector representations, so that it can be efficiently matched with the knowledge base content in the vector space. Vector retrieval is an important means to quickly locate content that is semantically relevant to the query task from a large-scale knowledge base, which can significantly improve retrieval efficiency.
[0047] Specifically, the pre-trained Embedding model is used to convert the query task into a semantic vector representation, and the document segments in the knowledge base are converted into vector form. Through vector retrieval, documents related to the query task can be quickly locked in the massive knowledge base, greatly shortening the retrieval time. The similarity between the query task vector and the knowledge base vector is calculated through the vector similarity algorithm, and the most relevant document fragments are recalled in descending order of similarity. Configure retrieval parameters (such as TopK value and similarity threshold) to screen high-quality retrieval results to build a preliminary retrieval result set. Accurate semantic matching ensures that the recalled content is highly relevant to the query task semantics, laying the foundation for subsequent sorting optimization.
[0048] S3.2: Calculate the search coverage between the preliminary search results and the manually annotated preliminary search result set, and update the semantic vector generation method of the Embedding model through rule optimization constraints according to the search coverage; The coverage of the preliminary search results directly affects the retrieval performance of the system. If the coverage is insufficient, important content may be missed. Through coverage evaluation, the Embedding model can be guided to optimize the semantic vector generation method, thereby improving the retrieval accuracy.
[0049] Specifically, we compare the preliminary search results with the manually annotated set, evaluate the proportion of relevant fragments recalled, and adjust the rules for generating semantic vectors by the Embedding model based on the coverage results, including: Increase the weight of low-frequency terms; Adjust feature distribution weights in vector generation; Update domain-specific semantic rules in vector generation; The optimization of coverage ensures that the retrieval results can fully reflect the semantic requirements of the query task and reduce the risk of missing key content. Through rule adjustment, the Embedding model performs more stably in subsequent retrieval tasks.
[0050] S3.3: When the retrieval result set of the Embedding model and the manually annotated preliminary retrieval result set reach a set retrieval threshold in terms of retrieval coverage, terminate the optimization training and use the optimized Embedding model for subsequent packaging; S3.4: extract multidimensional features from each search item in the preliminary search result set, calculate the feature distribution balance of the search items based on the multidimensional features, map the search items whose feature distribution balance is lower than the distribution threshold to an independent search space, and delete the corresponding search items from the preliminary search result set; In the preliminary search result set, there may be significant imbalance in the feature distribution of different search items. For example, the features of some items are densely distributed in a few dimensions, while the feature distribution of other items is too sparse. Unbalanced feature distribution will lead to calculation bias in subsequent model processing, such as some features being over-amplified or ignored, thus affecting the ranking effect of the re-ranking model. Feature distribution refers to how the feature values of each search item in the preliminary search result set are distributed in multiple dimensions. It is usually generated by the Embedding model and represents the numerical representation of each search item in dimensions such as semantic relevance, contextual consistency, and global weight. Feature distribution directly reflects the expression of the attributes of the search item in the multidimensional feature space.
[0051] Specifically, for each search item, feature vectors are extracted from the preliminary search results, including semantic relevance scores, contextual consistency indicators, and global citation weights. The feature vectors are subjected to distribution analysis, and the mean, variance, and frequency distribution of each dimension are calculated to form a feature distribution matrix. Search items with a balance lower than a set threshold are mapped to independent search spaces, and these search items are deleted from the preliminary search result set.
[0052] S3.5: adjusting the feature density of the preliminary search result set according to the feature distribution balance; Feature density adjustment can redistribute the proportion of features in different search items, making the overall distribution of the result set more balanced and avoiding wasting computing resources.
[0053] Specifically, the feature density adjustment includes: Calculate the feature distribution matrix according to the feature distribution balance of the search items in the preliminary search result set; According to the feature distribution matrix, the feature collaborative information amount of different search items in the preliminary search result set is calculated, and the density of the preliminary search result set is adjusted according to the feature collaborative information amount.
[0054] S3.6: In the independent retrieval space, the retrieval items are reconstructed by a feature compression algorithm to generate a low-dimensional feature representation, which can be adapted to the ranking format of the re-ranking model.
[0055] Since the feature distribution of some search items is poorly balanced, directly participating in the optimization of the preliminary search results may lead to a decrease in the quality of the overall search set. Therefore, they are mapped separately to an independent retrieval space for processing. In the independent retrieval space, the features of these search items need to be further compressed and reconstructed to remove redundant information, ensuring that even low-balance features can generate low-dimensional feature representations that are suitable for the reranking model.
[0056] Furthermore, the search items in the independent retrieval space usually have high-dimensional and low-correlation characteristics. Directly inputting them into the re-ranking model will increase the computational cost and affect the accuracy of the ranking results. Generating low-dimensional feature representations through feature compression can meet the input format requirements of the re-ranking model and improve processing efficiency.
[0057] Specifically, the principal components of the feature vector are extracted, and the first few principal components whose cumulative variance contribution rate reaches the set threshold (such as 90%) are selected to compress low-correlation dimensions. The generated low-dimensional feature representation retains the core information related to the retrieval item and the query task, while significantly reducing the dimension. Construct an encoder-decoder structure to perform nonlinear mapping on the feature vector and compress the high-dimensional features into the target low-dimensional space. During the training process, the sorting format of the re-ranking model is used as the decoding target to ensure that the generated low-dimensional feature representation is compatible with the subsequent model. By calculating the importance weight of each feature dimension (such as based on information gain or gradient contribution), high-weight features are selected as components of the low-dimensional feature representation. The low-balanced retrieval items are reconstructed through the feature compression algorithm to generate a low-dimensional feature representation to adapt the re-ranking model. Even retrieval items with uneven feature distribution can play an effective role in the subsequent model, while reducing the overall computational loss of the system.
[0058] The specific steps of S4 are as follows: S4.1: receiving a preliminary search result set and its low-dimensional feature representation; When receiving the preliminary search result set, the reranking model also accepts the low-dimensional feature representation generated in the independent search space. The preliminary search result set comes from the vector search results of the Embedding model. After feature optimization, it contains high-dimensional features such as semantic relevance and context consistency. The low-dimensional feature representation is the result generated by the feature compression algorithm in the independent search space, which condenses the key information of low-balanced search items, is compact and highly adaptable, and the two parts of data are processed in parallel to ensure that the combination of high-dimensional features and low-dimensional features provides sufficient support for subsequent sorting.
[0059] S4.2: construct a feature mapping matrix of the low-dimensional feature representation; In order to solve the compatibility problem between low-dimensional features and high-dimensional features in the re-ranking model, a feature mapping matrix is constructed. The mapping matrix not only realizes the conversion between features, but also enhances the role of low-dimensional features in the sorting logic; S4.3: performing auxiliary processing on the sorting process of the re-sorting model according to the feature mapping matrix; In the ranking optimization process of the re-ranking model, the collaborative information provided by the low-dimensional feature representation is used to identify potential irrelevant items in the initial search result set and downgrade them, thereby reducing ranking interference; Provide the global feature distribution trend after feature compression for the re-ranking model, which is used to optimize the global feature bias calibration of the ranking model and improve the overall consistency of the ranking results; The compactness of low-dimensional feature representation is utilized to reduce the complexity of the re-ranking model in feature interaction calculation, thereby improving the computational efficiency of the model.
[0060] S4.4: performing fusion processing on the optimization process of the reordering model according to the feature mapping matrix; In the feature optimization process of the preliminary search result set, the low-dimensional feature representation is used as a supplementary feature and combined with the high-dimensional feature representation of the preliminary search result set; According to the feature density information provided by the low-dimensional feature representation, the re-ranking model adjusts the attention weight of specific feature dimensions, thereby enhancing the rationality and relevance of feature distribution; The relevance of search terms in the preliminary search result set is enhanced through low-dimensional feature representation, the synergy of input features is optimized, and the sorting logic of the re-ranking model is made closer to the optimization standard of manual annotation.
[0061] The method further comprises: According to the real-time query tasks input by users, the corresponding query requirements are generated through the reasoning model in the intelligent agent; Input the query requirements into the embedding model of the intelligent agent, retrieve relevant knowledge base content and generate preliminary search results; Optimizing the preliminary search results through a re-ranking model in the agent to generate a ranked search result set; When the semantic relevance of the retrieval result set is lower than the result threshold, the reasoning model is recalled to regenerate the query requirement by analyzing the semantic distribution of the retrieval result set and the user input.
[0062] Exemplarily, an embodiment of the present invention provides a water conservancy and flood prevention intelligent agent, which is intended to provide users with accurate query and analysis functions, and supports query and dynamic analysis of key flood prevention information by accessing various data resources such as historical meteorology and hydrology. The intelligent agent works together through the inference model, the Embedding model, and the reordering model to realize the whole process from user natural language query to structured data return.
[0063] S101: The user inputs a query task through the system, for example: "Query the typhoon movement path and rainfall distribution in South China in the past 10 years.
[0064] S102: The reasoning model converts the natural language query input by the user into a structured query task, for example: Time frame: past 10 years; Geographical scope: South China; Query target: typhoon movement path and rainfall distribution.
[0065] S103: The reasoning model splits complex queries into multiple subtasks, including: Query historical typhoon path data; Query the rainfall distribution data related to typhoons.
[0066] S103: Combine domain rules and historical query records to optimize query tasks. For example, the “typhoon path” data should include fields such as “starting point, end point, and impact range”.
[0067] S104: Convert the query task into a high-dimensional semantic vector. For example, "typhoon path" is mapped into a set of spatial features, including the geographic coordinates, time series, and moving speed of the path points.
[0068] S105: The Embedding model uses vector similarity algorithms (such as cosine similarity) to retrieve content that matches the input vector in the knowledge base. The knowledge base includes a variety of historical meteorological data sources, such as: Historical typhoon track data; Historical rainfall distribution map; Historical flood area distribution data.
[0069] S106: Return multiple relevant documents or data fragments, including records of historical typhoon paths and a collection of images of rainfall distribution, and perform feature distribution balance analysis on the preliminary search results. For example, filter out some typhoon records whose time span does not conform to the "past 10 years" range, and retain highly relevant search items, such as "rainfall hotspot map in South China in the past 10 years."
[0070] S107: The re-ranking model receives the preliminary search results and their related features and performs priority ranking. Specifically, according to the important fields of the user's query task (such as "time range" and "geographic range"), a higher weight is given to the results with high relevance, and the typhoon records at adjacent time points are logically ranked by the context consistency rule, for example: Priority is given to returning complete typhoon tracks (full records from formation to dissipation).
[0071] S108: Supplement missing information based on specific requirements input by the user (such as "rainfall distribution"), for example, predict associated rainfall data from path data without labeled rainfall. Specifically, the results of the reordering model output are returned in the following format: Typhoon path data: geographical coordinates and time series of specific path points; Rainfall distribution map: Matches the hotspot distribution map of South China.
[0072] Example 2
[0073] See also Figure 3 , the present invention provides an embodiment: an agent automatic configuration system based on a large model, a knowledge base and a tool, the system comprising a reasoning model configuration module, a retrieval model configuration module and a re-ranking model configuration module; The inference model configuration module is used to receive the natural language content input by the user, parse it into a structured query task, and optimize the output of the inference model according to the manually annotated query task set so that it gradually matches the manually annotated query task set; The retrieval model configuration module is used to vectorize the structured query task using the Embedding model, search the preset knowledge base and generate a preliminary retrieval result set, and perform feature optimization and density adjustment on the preliminary retrieval result set; The re-ranking model configuration module is used to perform a ranking logic process on the optimized preliminary search result set, and adjust the ranking weight in combination with the feature mapping matrix to generate a final search result set that is consistent with the manually labeled optimization result.
[0074] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. An agent automatic configuration method based on a large model, knowledge base and tools, characterized in that: The method comprises: Acquire training data, wherein the training data includes natural language content input by multiple users; Input each natural language content into a preset reasoning model, and fix the output of the reasoning model to a manually annotated query task set; Inputting the manually annotated query task set into a preset Embedding model, wherein the Embedding model is configured to call a preset knowledge base, and fixing the output of the Embedding model to the manually annotated preliminary search result set; Inputting the manually annotated preliminary search result set into a preset re-ranking model, and fixing the output of the re-ranking model to the manually annotated optimized search result; After the training reaches a set number of times, or the similarity between the test result and the manually annotated optimized retrieval result is higher than the set similarity threshold, the final reasoning model, the Embedding model and the re-ranking model are encapsulated as an intelligent agent.
2. The method for automatic configuration of intelligent agents based on large models, knowledge bases and tools according to claim 1, characterized in that: The step of fixing the output of the inference model to a manually labeled query task set further includes: Generate an inference output, wherein the inference output is a preliminary query task set; Calculating the semantic similarity between the inference output and the manually annotated query task set, and optimizing the parameters of the inference model through iterative training according to the semantic similarity, so that the output of the inference model gradually approaches the manually annotated query task set until the semantic similarity reaches a set semantic threshold; The optimized inference model is used for subsequent packaging.
3. The method for automatic configuration of intelligent agents based on large models, knowledge bases and tools according to claim 2, characterized in that: The method of fixing the output of the Embedding model to a manually annotated preliminary search result set further includes: Generate a semantic vector representation corresponding to each query task, and perform vector retrieval in the preset knowledge base to recall preliminary retrieval results related to the semantics of the query task; Calculate the search coverage between the preliminary search results and the manually annotated preliminary search result set, and update the semantic vector generation method of the Embedding model through rule optimization constraints according to the search coverage; When the retrieval result set of the Embedding model and the manually annotated preliminary retrieval result set reach a set retrieval threshold in terms of retrieval coverage, the optimization training is terminated and the optimized Embedding model is used for subsequent packaging.
4. The method for automatic configuration of intelligent agents based on large models, knowledge bases and tools according to claim 1, characterized in that: Before inputting the manually annotated query task set into the preset Embedding model, the method further includes: Optimize the semantic structure of the output of the reasoning model; According to the query task after the semantic structure optimization, the semantic content of the query task is divided into high-frequency features and low-frequency features, and dynamic weights are assigned to different frequency features according to the vectorization requirements of the Embedding model to generate an input feature set; According to the input feature set, a format for the input requirements of the Embedding model is generated through an input converter.
5. The method for automatic configuration of intelligent agents based on large models, knowledge bases and tools according to claim 4 is characterized in that: The semantic structure optimization includes: Decomposing the query task into fine-grained subtasks according to semantic parsing rules, wherein the subtasks include key semantic units and attribute descriptions; Through the context information completion algorithm, context information related to the semantics of the preset knowledge base is added to the fine-grained subtask to update the query task.
6. The method for automatic configuration of intelligent agents based on large models, knowledge bases and tools according to claim 4, characterized in that: Before inputting the manually annotated preliminary search result set into the preset re-ranking model, the method further includes: Extract multidimensional features from each search item in the preliminary search result set, calculate the feature distribution balance of the search items based on the multidimensional features, map the search items whose feature distribution balance is lower than the distribution threshold to an independent search space, and delete the corresponding search items from the preliminary search result set; Adjusting the feature density of the preliminary search result set according to the feature distribution balance; In the independent retrieval space, the retrieval items are reconstructed by a feature compression algorithm to generate a low-dimensional feature representation, which can be adapted to the ranking format of the re-ranking model.
7. The method for automatic configuration of intelligent agents based on large models, knowledge bases and tools according to claim 6, characterized in that: The feature density adjustment includes: Calculate the feature distribution matrix according to the feature distribution balance of the search items in the preliminary search result set; According to the feature distribution matrix, the feature collaborative information amount of different search items in the preliminary search result set is calculated, and the density of the preliminary search result set is adjusted according to the feature collaborative information amount.
8. The method for automatic configuration of intelligent agents based on large models, knowledge bases and tools according to claim 7, characterized in that: The step of fixing the output of the re-ranking model to the manually annotated optimized search result further includes: Constructing a feature mapping matrix of the low-dimensional feature representation; Performing auxiliary processing on the sorting process of the re-sorting model according to the feature mapping matrix; The optimization process of the reordering model is fused according to the feature mapping matrix.
9. The method for automatic configuration of intelligent agents based on large models, knowledge bases and tools according to claim 1, characterized in that: The method further comprises: According to the real-time query tasks input by users, the corresponding query requirements are generated through the reasoning model in the intelligent agent; Input the query requirements into the embedding model of the intelligent agent, retrieve relevant knowledge base content and generate preliminary search results; Optimizing the preliminary search results through a re-ranking model in the agent to generate a ranked search result set; When the semantic relevance of the retrieval result set is lower than the result threshold, the reasoning model is recalled to regenerate the query requirement by analyzing the semantic distribution of the retrieval result set and the user input.
10. An agent automatic configuration system based on a large model, a knowledge base and a tool, implemented based on an agent automatic configuration method based on a large model, a knowledge base and a tool as claimed in any one of claims 1 to 9, characterized in that: The system includes a reasoning model configuration module, a retrieval model configuration module and a re-ranking model configuration module; The inference model configuration module is used to receive the natural language content input by the user, parse it into a structured query task, and optimize the output of the inference model according to the manually annotated query task set so that it gradually matches the manually annotated query task set; The retrieval model configuration module is used to vectorize the structured query task using the Embedding model, search the preset knowledge base and generate a preliminary retrieval result set, and perform feature optimization and density adjustment on the preliminary retrieval result set; The re-ranking model configuration module is used to perform a ranking logic process on the optimized preliminary search result set, and adjust the ranking weight in combination with the feature mapping matrix to generate a final search result set that is consistent with the manually labeled optimization result.
Citation Information
Patent Citations
Configuration method and device of large model application agent
CN118819617A
Structured query language generation method and device, electronic equipment and storage medium
CN118093621A
Medical question and answer method and system based on large language model and storage medium
CN118152533A
Question and answer method, device and equipment and computer readable storage medium
CN118394892A
Financial bill and non-tax collection intelligent data analysis platform
CN118964399A
Cited By
Automatic contract auditing system and method based on multi-agent collaboration
CN120493908A
Autonomous controllable heterogeneous data driven agent collaborative optimization system and method
CN120596627A
An autonomously controllable heterogeneous data-driven agent coordination optimization system and method
CN120596627B