Rag retrieval optimization method, device and medium based on multi-dimensional enhancement
By using the multi-dimensional enhanced RAG retrieval optimization method, enterprise knowledge data is automatically divided into multi-level and multi-granularity feature dimensions. By combining holistic embedding and block embedding methods to generate semantic attribute feature embedding vectors, the problem of low information retrieval efficiency and insufficient cross-task knowledge transfer capability caused by the reliance on manual dimension division in existing technologies is solved, and efficient adaptive knowledge retrieval is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INSPUR GENERSOFT CO LTD
- Filing Date
- 2025-10-21
- Publication Date
- 2026-04-17
AI Technical Summary
When processing multi-source heterogeneous enterprise knowledge data, existing RAG technology relies on manual dimensional segmentation, lacks automation and consistency guarantees, resulting in low information retrieval efficiency and insufficient cross-task knowledge transfer capabilities.
The RAG retrieval optimization method based on multi-dimensional enhancement is adopted. It automatically divides enterprise knowledge data into multi-level and multi-granular feature dimensions through a hybrid guidance mechanism and conflict resolution algorithm. It generates feature embedding vectors of semantic attributes by combining overall embedding and block embedding methods, and adapts to business changes through a dynamic weight optimization mechanism.
It combines autonomous partitioning of large models with expert adjudication, improving retrieval accuracy and adaptability in cross-task retrieval scenarios, and solving the problem of low information retrieval efficiency caused by reliance on manual dimensional partitioning.
Smart Images

Figure CN120973924B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data management technology, specifically relating to a RAG retrieval optimization method, device, and medium based on multi-dimensional enhancement. Background Technology
[0002] Enterprise knowledge management is a crucial component of data management, and its knowledge retrieval and data generation primarily rely on Retrieval Augmentation (RAG) technology. As an artificial intelligence framework that combines information retrieval systems with the generative capabilities of Large Language Models (LLMs), RAG technology's implementation mainly depends on manual classification and keyword retrieval, single vector embedding models, and hybrid memory models. Specifically:
[0003] (1) Manual dimensional classification and keyword retrieval. Representative solutions include the IBM FileNet content classification engine based on folder hierarchy and a manually defined tagging system. The technical feature of this approach is that documents are classified or tagged by manually preset rules, and retrieval is achieved by keyword matching. The limitation is that manual classification is costly and cannot dynamically adapt to changes in business needs.
[0004] (2) Single Vector Embedding Model. Representative solutions include basic vector retrieval on the Tencent Cloud TI platform based on overall document embedding. Its technical feature is that the entire document is converted into vectors, and similarity search is performed using tools such as FAISS. Its limitation is that the dimensional information is not processed in a structured manner, resulting in the loss of fine-grained information and weak cross-task generalization ability.
[0005] (3) Hybrid memory modules. Representative solutions include MemGPT, which manages memory by simulating an operating system, and ChatDB, which combines databases with symbolic reasoning. They attempt to integrate structured and unstructured data, but rely on predefined attributes or manually designed rules.
[0006] In summary, the RAG technologies described above, which combine manual segmentation with keyword retrieval, single vector embedding models, and hybrid memory modes, suffer from low information retrieval efficiency and insufficient cross-task knowledge transfer capabilities when processing multi-source heterogeneous enterprise knowledge data. Dimension segmentation relies on manual intervention and lacks automation and consistency guarantees. Summary of the Invention
[0007] This application aims to provide a multi-dimensional enhanced RAG retrieval optimization scheme that can automatically construct business dimensions, maintain fine-grained retrieval, and dynamically adapt to business changes. It aims to address the problems of existing technologies in processing multi-source heterogeneous enterprise knowledge data, where dimension division relies on manual intervention, lacks automation and consistency guarantees, resulting in low information retrieval efficiency and insufficient cross-task knowledge transfer capabilities.
[0008] According to a first aspect of this application, this application provides a multi-dimensional enhanced RAG retrieval optimization method, comprising:
[0009] Based on prompt word templates and inter-dimensional relationships, a hybrid guidance mechanism and conflict resolution algorithm are designed. Using the hybrid guidance mechanism and conflict resolution algorithm, the large model is guided to automatically divide enterprise knowledge data into multi-level and multi-granular feature dimensions, and the feature dimensions are fused or expanded according to the inter-dimensional relationships.
[0010] Based on the description and division rules of the feature dimensions, we mine the semantic attributes of the original corpus corresponding to enterprise knowledge data in the feature dimensions. We generate and store the feature embedding vectors corresponding to the semantic attributes by combining the overall embedding method and the block embedding method, combined with the dimension weights.
[0011] When the large language model obtains a user question, it extracts the relevant feature dimensions from the user question and dynamically scales the granularity of the feature dimensions according to the retrieval requirements. It then performs feature enhancement on the scaled feature dimensions to obtain the query vector.
[0012] Based on the embedding vector retrieval algorithm, the optimal match between the query vector and the feature embedding vector is found by combining semantic weights, and the most matching feature embedding vector is obtained.
[0013] A dynamic weight optimization mechanism is designed to dynamically adjust the dimension weights and semantic weights based on semantic similarity and dimension frequency, respectively.
[0014] Preferably, in the above-mentioned RAG retrieval optimization method, the steps of designing a hybrid guidance mechanism and conflict resolution algorithm based on prompt word templates and inter-dimensional relationships, guiding the large model to automatically divide enterprise knowledge data into multi-level, multi-granularity feature dimensions according to the hybrid guidance mechanism and conflict resolution algorithm, and fusing or expanding the feature dimensions according to the inter-dimensional relationships include:
[0015] Design prompt word templates and use them to guide the large language model to extract multiple feature dimensions from the original corpus corresponding to enterprise knowledge data.
[0016] Detect the semantic coordinate drift of each fixed feature dimension in the multi-feature dimension, and fuse or split the feature dimensions according to the semantic coordinate drift.
[0017] By preserving the interdimensional relationships and historical evolutionary trajectories between the feature dimensions of fusion or splitting, a dimensional lineage map is obtained;
[0018] By combining dimensional lineage maps and prompt word templates, descriptive partitioning rules are written for each feature dimension.
[0019] Preferably, in the above RAG retrieval optimization method, the step of designing prompt word templates and using these templates to guide the large language model to extract multi-dimensional features from the original corpus corresponding to enterprise knowledge data includes:
[0020] Construct a domain-dimensional framework and add resource description information corresponding to the original corpus;
[0021] When newly added resource description information cannot match the existing feature dimensions of the domain dimension framework, it is assigned to a new feature dimension according to the core function of the resource through a coarse-grained attribution method.
[0022] Alternatively, when the original corpus corresponding to the existing feature dimension exceeds the predetermined number of items, the feature dimension can be split into multiple sub-dimensions through dimension splitting.
[0023] Establish a hierarchical relationship diagram between different feature dimensions in the domain dimension framework, and construct a cross-dimensional resource pool based on the different feature dimensions to which the same original corpus belongs.
[0024] Preferably, in the above RAG retrieval optimization method, the step of detecting the semantic coordinate drift of each fixed feature dimension in the multi-feature dimension, and fusing or splitting the feature dimensions according to the semantic coordinate drift, includes:
[0025] Based on the feature embedding vectors of the most recent documents under the fixed feature dimension, the semantic centroid vector of the feature dimension is maintained through the embedding model;
[0026] When a new document is classified into the feature dimension by the large language model, the semantic difference between the semantic centroid vector of the feature dimension and the feature embedding vector of the new document is calculated.
[0027] When the semantic difference is greater than a predetermined difference threshold, it is determined that there is semantic coordinate drift in the feature dimension;
[0028] The first triplet is constructed using semantic difference, new documents, and feature dimensions. The first triplet is then pushed to the business expert or expert experience model. Based on the feedback from the business expert or expert experience model, the feature dimensions are split or the semantic centroid vector is replaced.
[0029] Calculate the semantic difference between the semantic centroid vectors of two adjacent feature dimensions. When the semantic difference is greater than a predetermined difference threshold, construct a second triplet using the semantic difference and the two adjacent feature dimensions and push it to the business expert or expert experience model. Selectively fuse the two adjacent feature dimensions based on the feedback results from the business expert or expert experience model.
[0030] Preferably, in the above RAG retrieval optimization method, the steps of mining the semantic attributes of the original corpus corresponding to enterprise knowledge data in the feature dimensions according to the description and division rules of the feature dimensions, and generating and storing the feature embedding vectors corresponding to the semantic attributes by combining the overall embedding method and the block embedding method with the dimension weights, include:
[0031] The large language model is guided by prompt word templates, and the semantic attributes of the original corpus are extracted on different feature dimensions according to the description and division rules of the feature dimensions.
[0032] In the holistic embedding method, an embedding model is used to convert all semantic attributes corresponding to the original corpus into a holistic embedding vector. The holistic embedding vector is then concatenated with the embedding results of the original corpus to obtain the feature embedding vector corresponding to the semantic attribute.
[0033] In the chunked embedding method, all dimension-attribute pairs of the same document are converted into natural language descriptions.
[0034] By combining natural language descriptions, an embedding model is used to independently encode each dimension-attribute pair into a block feature embedding vector;
[0035] Based on the dimension weights corresponding to the feature dimensions, all block feature embedding vectors in the same document are weighted and fused to obtain a block fusion vector.
[0036] By concatenating the segmented fusion vector with the embedding results of the original corpus, we obtain the feature embedding vector corresponding to the semantic attributes;
[0037] Use a vector database to build an index of feature embedding vectors and establish the association between the feature embedding vectors and the corresponding metadata in the original corpus.
[0038] Preferably, in the above RAG retrieval optimization method, when the large language model obtains a user question, the steps of extracting the relevant feature dimensions from the user question, dynamically scaling the granularity of the feature dimensions according to the retrieval requirements, and performing feature enhancement on the scaled feature dimensions to obtain the query vector include:
[0039] By using prompt word templates, the large language model is guided to extract key feature dimensions from user questions;
[0040] Based on the requirements of retrieval accuracy and retrieval scope, the relatively fine-grained key feature dimensions can be expanded to a coarser-grained range through the dimensional lineage map, or the relatively coarse-grained key feature dimensions can be expanded to a subset dimension.
[0041] The search scope is initially filtered based on the domain dimensions involved in the user's question;
[0042] After the initial filtering, the domain dimension and the original user question are transformed into corresponding embedding vectors through the embedding model. The embedding vectors are then concatenated to form a query vector with enhanced features.
[0043] Preferably, in the above RAG retrieval optimization method, the step of finding the optimal match between the query vector and the feature embedding vector based on the embedding vector retrieval algorithm and semantic weights to obtain the most matching feature embedding vector includes:
[0044] The embedding vector retrieval method is used to calculate the feature dimension similarity and semantic similarity between the query vector and the feature embedding vector;
[0045] By combining feature dimension similarity and semantic similarity, as well as the similarity weight of semantic similarity, the overall similarity between the query vector and the feature embedding vector is calculated using a weighted average.
[0046] Return the top N feature embedding vectors with the highest overall similarity as the best matching feature embedding vectors mentioned above.
[0047] Preferably, in the above RAG retrieval optimization method, the step of designing a dynamic weight optimization mechanism and using the dynamic weight optimization mechanism to dynamically adjust the dimension weight and semantic weight based on semantic similarity and dimension frequency respectively includes:
[0048] Calculate the semantic similarity between two user questions. When the semantic similarity is higher than a predetermined similarity threshold, count the error-prone feature dimension.
[0049] When error-prone feature dimensions appear, increase the semantic weight of semantic similarity;
[0050] Determine whether the next user question contains new feature dimensions. If the next user question contains new feature dimensions, reduce the semantic weight of semantic similarity.
[0051] Use a multi-armed slot machine model to learn the dimensional weights of feature dimensions online;
[0052] Calculate the representation value of the user's clicked document on the corresponding feature dimension. When the representation value is higher than the predetermined representation threshold, generate a positive reward for the feature dimension.
[0053] The dimensional weights are dynamically updated using a weight update algorithm based on positive rewards.
[0054] According to a second aspect of this application, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the RAG retrieval optimization method based on multi-dimensional enhancement provided by any of the above technical solutions.
[0055] According to a third aspect of this application, this application also provides a computer storage medium storing a computer program thereon, which, when executed by a processor, implements the RAG retrieval optimization method based on multi-dimensional enhancement as provided in any of the above technical solutions.
[0056] The technical solution of this application has at least the following technical effects:
[0057] This application provides a multi-dimensional enhanced RAG retrieval optimization scheme. It designs a hybrid guidance mechanism and conflict resolution algorithm based on prompt word templates and inter-dimensional relationships. The hybrid guidance mechanism enables a large model to autonomously divide enterprise knowledge data into multi-level and multi-granularity feature dimensions. The conflict resolution algorithm can fuse or expand feature dimensions according to inter-dimensional relationships. This allows for hybrid initialization and incremental expansion of feature dimensions through a combination of "autonomous division by the large model" and "business expert adjudication." Then, based on the feature dimension description and division rules, the semantic attributes of the original corpus corresponding to the enterprise knowledge data on the feature dimensions are mined. Using a combination of holistic embedding and segmented embedding methods, and incorporating dimension weights, feature embedding vectors corresponding to the semantic attributes are generated and stored. This method solves the problems of fine-grained information loss in holistic embedding and semantic fragmentation in single segmented embedding in existing technologies, thereby improving retrieval accuracy in cross-task retrieval scenarios. When the large language model receives a user question, it extracts the relevant feature dimensions from the question and dynamically scales the granularity of these feature dimensions according to retrieval requirements. The scaled feature dimensions are then augmented to obtain a query vector. This allows for scaling the feature dimensions to meet different retrieval precision and scope requirements. Finally, based on the embedding vector retrieval algorithm and semantic weights, the optimal match between the query vector and the feature embedding vector is found, resulting in the matched feature embedding vector. After obtaining the matched feature embedding vector, this application also involves a dynamic weight optimization mechanism. In this mechanism, dimension weights and semantic weights are dynamically adjusted based on semantic similarity and dimension frequency, enabling the entire system to automatically perceive and adapt to priority changes in different business scenarios, achieving business-aware adaptive retrieval. In summary, the above technical solution addresses the problems of existing technologies in processing multi-source heterogeneous enterprise knowledge data, where dimension segmentation relies on manual methods, lacks automation and consistency guarantees, leading to low information retrieval efficiency and insufficient cross-task knowledge transfer capabilities. Attached Figure Description
[0058] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0059] Figure 1 A flowchart illustrating the first RAG retrieval optimization method based on multi-dimensional enhancement provided in this application embodiment;
[0060] Figure 2 A flowchart illustrating the second RAG retrieval optimization method based on multi-dimensional enhancement provided in this application embodiment;
[0061] Figure 3 A flowchart illustrating a database construction and vector retrieval method based on multidimensional feature enhancement provided in this application embodiment;
[0062] Figure 4 A flowchart illustrating a whole-body embedding and block-body embedding method provided in an embodiment of this application;
[0063] Figure 5 A schematic diagram of the structure of a retrieval optimization system based on multidimensional feature enhancement provided in an embodiment of this application;
[0064] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0065] To more clearly illustrate the overall concept of this application, a detailed explanation is provided below with reference to the accompanying drawings.
[0066] Many specific details are set forth in the following description to provide a thorough understanding of this application. However, this application may also be implemented in other ways different from those described herein. Therefore, the scope of protection of this application is not limited to the specific embodiments disclosed below. It should be noted that, unless otherwise specified, the embodiments of this application and the features thereof can be combined with each other.
[0067] In this application, unless otherwise expressly specified and limited, the terms "above" and "below" the second feature can refer to direct contact between the first and second features, or indirect contact between the first and second features through an intermediate medium. In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described can be combined in any suitable manner in one or more embodiments or examples.
[0068] The existing technology has the following drawbacks:
[0069] Current RAG technology primarily relies on manual classification and keyword retrieval, single vector embedding models, and hybrid memory models. These approaches suffer from the following technical problems:
[0070] Question 1: When traditional RAG systems process multi-source heterogeneous enterprise knowledge, the dimensional division relies on manual methods and lacks automation and consistency guarantees.
[0071] Question 2: Overall embedding leads to the loss of fine-grained semantics and low cross-task retrieval accuracy.
[0072] Question 3: Lack of a context-based dynamic weighting mechanism, making it unable to adapt to changes in business requirements.
[0073] To address the aforementioned technical issues, the following embodiments of this application provide a multi-dimensional enhanced RAG retrieval optimization scheme. Through a dimensional autonomy mechanism of "hybrid guidance + conflict detection," combined with expert knowledge and large-scale model autonomous expansion, it supports incremental multi-dimensional construction. Furthermore, it proposes a representation learning method of "block embedding + global fusion" to effectively solve the problems of fine-grained loss and semantic fragmentation. Additionally, by scaling the dimensions, it meets the needs for different retrieval precision and scope. Finally, it introduces a dynamic weight optimization model based on reinforcement learning (such as the EXP3 algorithm) to achieve business-aware adaptive retrieval.
[0074] To achieve the above objectives, see [link to relevant documentation]. Figure 1 , Figure 1 A flowchart illustrating a multi-dimensional enhanced RAG retrieval optimization method provided in this application embodiment is shown below. Figure 1 As shown, this application provides a multi-dimensional enhanced RAG retrieval optimization method, including:
[0075] S110: Based on prompt word templates and inter-dimensional relationships, a hybrid guidance mechanism and conflict resolution algorithm are designed. Using the hybrid guidance mechanism and conflict resolution algorithm, the large model is guided to automatically divide enterprise knowledge data into multi-level and multi-granular feature dimensions, and the feature dimensions are fused or expanded according to the inter-dimensional relationships.
[0076] The technical solution provided in this application's embodiments designs a hybrid guidance mechanism and conflict resolution algorithm based on prompt word templates and inter-dimensional relationships. This hybrid guidance mechanism and conflict resolution algorithm can automate dimensional partitioning and automatically resolve conflicts between feature dimensions. Specifically, it employs a hybrid initialization and incremental expansion mechanism combining "autonomous partitioning by a large model" and "business expert adjudication," and introduces dimensional conflict detection and fusion algorithms (such as threshold judgment based on semantic similarity). This solves the problem of high cost or large bias caused by relying solely on experts or models, enabling the dimensional system to both conform to business specifications and adapt to the growth of the knowledge base. This allows for the division of the raw corpus (reports, regulations, and other documents) required for the company's normal operation into multi-level, multi-granularity feature dimensions, providing a structured framework for subsequent feature mining and retrieval, based on the company's actual operational needs.
[0077] Traditional feature dimension partitioning (knowledge engineering) is highly dependent on experts, costly, and difficult to scale. Although Large Language Models (LLMs) possess powerful semantic understanding capabilities, how to effectively use them to automatically and structurally construct enterprise knowledge systems while ensuring their consistency with business specifications remains an open challenge. This application's embodiments aim to address this core issue by designing a hybrid guidance mechanism and conflict resolution algorithm.
[0078] Specifically, in a preferred embodiment, step S110, which involves designing a hybrid guidance mechanism and conflict resolution algorithm based on prompt word templates and inter-dimensional relationships, guiding the large model to automatically divide enterprise knowledge data into multi-level, multi-granularity feature dimensions according to the hybrid guidance mechanism and conflict resolution algorithm, and fusing or expanding the feature dimensions according to the inter-dimensional relationships, includes:
[0079] S111: Design prompt word templates and use them to guide the large language model to extract multiple feature dimensions from the original corpus corresponding to enterprise knowledge data.
[0080] Feature dimensions include, but are not limited to, domain dimensions, business dimensions, product dimensions, professional dimensions, organizational dimensions, type dimensions, and source dimensions. For example:
[0081] Areas of expertise: finance, human resources, production, and legal affairs, etc.
[0082] Business dimensions: sales, procurement, and customer service, etc.
[0083] Organizational dimensions: group, company, department, and position, etc.
[0084] The aforementioned domain, business, and organizational dimensions belong to multiple levels, while the domain, financial, and sub-financial dimensions belong to granularity.
[0085] Specifically, prompt word templates guide large language models (such as GPT-4, Tongyi Qianwen, and Deepseek) to extract dimensions from the original corpus. The prompt word design should consider iterative processing capabilities, supporting step-by-step processing of large datasets, temporary storage of intermediate results, and incremental updates.
[0086] S112: Detect the semantic coordinate drift of each fixed feature dimension in the multi-feature dimension, and fuse or split the feature dimensions according to the semantic coordinate drift.
[0087] Specifically, as a preferred embodiment, in the above RAG retrieval optimization method, step S112: detecting the semantic coordinate drift of each fixed feature dimension in the multi-feature dimension, and fusing or splitting the feature dimensions according to the semantic coordinate drift, specifically includes:
[0088] S1121: Based on the feature embedding vectors of the most recent documents under the fixed feature dimension, maintain the semantic centroid vector of the feature dimension through the embedding model.
[0089] S1122: When a new document is classified into the feature dimension by the large language model, calculate the semantic difference between the semantic centroid vector of the feature dimension and the feature embedding vector of the new document.
[0090] S1123: When the semantic difference is greater than the predetermined difference threshold, it is determined that there is a semantic coordinate drift in the feature dimension.
[0091] S1124: Construct the first triplet using semantic difference, new document, and feature dimension. Push the first triplet to the business expert or expert experience model. Split the feature dimension or change the semantic centroid vector according to the feedback results of the business expert or expert experience model.
[0092] S1125: Calculate the semantic difference between the semantic centroid vectors of two adjacent feature dimensions. When the semantic difference is greater than a predetermined difference threshold, construct a second triplet using the semantic difference and the two adjacent feature dimensions and push it to the business expert or expert experience model. Selectively fuse the two adjacent feature dimensions based on the feedback results from the business expert or expert experience model.
[0093] As a preferred embodiment, the dimensional semantic coordinate drift detection is as follows:
[0094] 1) Maintain a semantic centroid vector C for each fixed feature dimension D. D = MeanPooling(embedding vectors V of the N nearest documents in this dimension) final) Semantic centroid vectors can be obtained by embedding them into the model. Typically, if a set of documents corresponding to a feature dimension D reaches a specified number (e.g., 10) and shares a common semantic centroid vector, then that feature dimension is considered fixed.final This represents the final embedding vector of the document, which is obtained by averaging the feature embedding vectors calculated through the embedding model.
[0095] 2) When a new document d_new is suggested by the large model to be included in dimension D, calculate the feature embedding vector V of the new document. d_new The semantic centroid vector C of the feature dimension D The semantic difference between them is Δ=‖V d_new –C D If the semantic difference Δ > τ (the predetermined difference threshold τ can be set to 0.4~0.6 depending on the business), then a "dimensionality drift alarm" will be triggered.
[0096] 3) The system pushes triples (Δ, d_new, dimension D description) to business experts, supporting one-click "split dimension" or "update centroid". This dimension D description can be generated from a large model.
[0097] 4) Calculate the semantic difference between dimensions Δ = ||C D i –C D j If the semantic centroids of two feature dimensions become increasingly close (Δ > τ), a "dimensional fusion event" is triggered, pushing a triple (Δ, dimension Di description, dimension Dj description) to business experts for them to determine whether to fuse the two dimensions.
[0098] S113: Preserve the interdimensional relationships and historical evolution trajectories between the feature dimensions of fusion or splitting to obtain a dimensional lineage map.
[0099] Dimensional lineage maps can clearly show the fusion and splitting processes between related feature dimensions. The establishment of a dimensional lineage map includes the following steps:
[0100] 1) Whenever dimension Di is split into sub-dimensions {Di1,Di2,…} or merged (see the dimension drift detection process above for details), record the operation type, operator, operation time, and triggering condition (semantic difference Δ value or threshold trigger for drift).
[0101] 2) Use Neo4j to store the pedigree graph nodes (dimensions) and edges (split / merge events).
[0102] 3) Provide a "Dimension Evolution Dashboard" on the system UI side, which supports viewing the historical evolution trajectory of any dimension.
[0103] S114: Combine dimensional lineage maps and prompt word templates to write descriptive partitioning rules for each feature dimension.
[0104] The process of writing the partitioning rules is as follows: Write clear partitioning rules for each feature dimension. Dimension descriptions and partitioning criteria are crucial for batch feature attribute mining. The partitioning criteria can be written by business experts or generated by a large language model. Specifically, an example of partitioning criteria is as follows:
[0105] Domain Dimension - Finance: Covers financial statements, budget plans, and cost accounting, etc.
[0106] Organizational Dimension - Departments: Divided by departmental functions (e.g., finance department and human resources department).
[0107] In addition, as a preferred embodiment, in the above RAG retrieval optimization method, step S111: designing prompt word templates and using prompt word templates to guide the large language model to extract multi-dimensional features from the original corpus corresponding to enterprise knowledge data, includes:
[0108] S1111: Construct a domain-dimensional framework and add resource description information corresponding to the original corpus.
[0109] S1112: When the newly added resource description information cannot match the existing feature dimensions of the domain dimension framework, it is assigned to the new feature dimension according to the core function of the resource through a coarse-grained attribution method.
[0110] or,
[0111] S1113: When the original corpus corresponding to the existing feature dimension exceeds the predetermined number of items, the feature dimension is split into multiple sub-dimensions through dimension splitting.
[0112] S1114: Establish a hierarchical relationship diagram between different feature dimensions in the domain dimension framework, and construct a cross-dimensional resource pool based on the different feature dimensions to which the same original corpus belongs.
[0113] Specifically, the prompt word design example is as follows:
[0114] **Role:** You are the Enterprise Knowledge System Architect, responsible for building a complete domain-dimensional framework through multiple iterations.
[0115] **Core Capabilities**: Supports incremental updates, conflict detection, and dimension fusion, outputting storable intermediate results after each processing of new data.
[0116] ### **Processing Flow**
[0117] **Input Instructions**:
[0118] - `Current Frame`: Existing dimensional frame (initially empty)
[0119] - `New Resource`: Description of the original corpus processed in this instance
[0120] ### **Dimension Expansion Rules**
[0121] **When a new resource cannot match an existing dimension:**
[0122] 1. **Dimension Generation**:
[0123] - Coarse-grained attribution: Classified by core resource function (e.g., `Equipment Fault Diagnosis Report` → belongs to `Production and Operations`). This coarse-grained attribution applies to the feature dimension fusion part.
[0124] - Automatic splitting: When a single dimension corresponds to more than 10 original resources, sub-dimension creation is triggered.
[0125] 2. **Sub-dimension Creation**:
[0126] Threshold trigger: Dimensional resource quantity > 10
[0127] The generated solution suggests splitting {dimension name} into: {subdivision options}.
[0128] Example: Organizational dimension → Split into [Group, Company, Department]
[0129] 3. **Multi-dimensional correlation**:
[0130] - Establish a relationship diagram: `Legal Field → Contract Approval Process (Business Dimension)`
[0131] - Cross-dimensional resource pool: Patent documents exist simultaneously in the "technical field" and the "legal field".
[0132] Figure 1 The technical solution provided in the illustrated embodiment, in step S110: designing a hybrid guidance mechanism and conflict resolution algorithm based on prompt word templates and inter-dimensional relationships; using the hybrid guidance mechanism and conflict resolution algorithm to guide the large model to automatically divide enterprise knowledge data into multi-level, multi-granularity feature dimensions; and after fusing or expanding the feature dimensions according to the inter-dimensional relationships, it further includes:
[0133] S120: Based on the description and division rules of the feature dimensions, mine the semantic attributes of the original corpus corresponding to the enterprise knowledge data in the feature dimensions. Based on the combination of the overall embedding method and the block embedding method, generate and store the feature embedding vectors corresponding to the semantic attributes in combination with the dimension weights.
[0134] In this embodiment, after dividing the feature dimensions, the semantic attributes of the original corpus corresponding to the enterprise knowledge data are mined on the feature dimensions. This allows the original corpus corresponding to the enterprise knowledge data to be mapped to specific dimensions, and its attribute values to be extracted, thereby forming structured labels. This solves the problem in the prior art that relies on manual attributes or unstructured data, which makes it difficult to distinguish key details from noise and affects semantic expression.
[0135] Furthermore, by combining holistic embedding and segmented embedding, feature embedding vectors corresponding to semantic attributes are generated and stored using dimensional weights, thus maintaining the fine-grainedness of the embedding process. This application's embodiments creatively employ a segmented embedding strategy using "dimension-attribute pairs," effectively solving the problems of fine-grained information loss in holistic embedding and semantic fragmentation in single segmented embedding, thereby improving accuracy in cross-task retrieval scenarios.
[0136] Specifically, as a preferred embodiment, step S120 above: according to the description and division rules of the feature dimensions, mining the semantic attributes of the original corpus corresponding to the enterprise knowledge data in the feature dimensions, and generating and storing the feature embedding vectors corresponding to the semantic attributes by combining the overall embedding method and the block embedding method, combined with the dimension weights, specifically includes:
[0137] S121: Guide the large language model through prompt word templates, and extract the semantic attributes of the original corpus on different feature dimensions according to the description and division rules of the feature dimensions.
[0138] S122: In the holistic embedding method, the embedding model is used to convert all semantic attributes corresponding to the original corpus into holistic embedding vectors. The holistic embedding vectors are then concatenated with the embedding results of the original corpus to obtain the feature embedding vectors corresponding to the semantic attributes.
[0139] S123: In the chunked embedding method, all dimension-attribute pairs of the same document are converted into natural language descriptions respectively.
[0140] S124: Combining natural language descriptions, embedding models are used to independently encode each dimension-attribute pair into block feature embedding vectors.
[0141] S125: According to the dimension weights corresponding to the feature dimensions, weighted fuse all block feature embedding vectors in the same document to obtain the block fusion vector.
[0142] S126: Concatenate the segmented fusion vector with the embedding result of the original corpus to obtain the feature embedding vector corresponding to the semantic attribute.
[0143] S127: Use a vector database to construct an index of feature embedding vectors and establish a relationship between the feature embedding vectors and the corresponding metadata in the original corpus.
[0144] The technical solution provided in this application includes two parts: feature attribute (i.e., semantic attribute) mining and feature dimension embedding (i.e., generating feature embedding vectors corresponding to semantic attributes); the main goal is to map the original corpus to specific dimensions, extract its semantic attribute values, and form structured labels. Specifically, as follows... Figure 3 As shown, it includes the following:
[0145] (1) Feature attribute mining:
[0146] The large language model is guided by prompt words, and semantic attribute values of the original data (i.e., the original corpus) on different feature dimensions are extracted according to the feature dimension description and segmentation rules obtained in the above steps. This application allows the same corpus to be labeled to multiple dimensions.
[0147] The following is an example of the results of feature attribute mining:
[0148] Company A's Q1 2025 financial quarterly report: (Financial domain: financial statements) AND (Organizational dimension: Company A) AND (Time dimension: Q1 2025) AND (Report type: financial report).
[0149] Example: June employee performance appraisal records for Department A: (Human Resources: Attendance Records) AND (Organization Dimension: Department A) AND (Time: June) AND (Corpus Type: CSV).
[0150] (2) Feature dimension embedding:
[0151] The mining results of feature dimensions (the attribute values of the original corpus in different feature dimensions) are vectorized (i.e., feature dimension embedding or multi-dimensional feature embedding). Feature dimension embedding can use publicly available embedding models such as "text-embedding-3-large" and "text-embedding-ada-002".
[0152] Combination Figure 4 As shown in the flowcharts illustrating the overall embedding and block embedding methods, feature dimension embedding methods include, but are not limited to, the following two approaches:
[0153] 1) Holistic Embedding Method: The complete results of semantic attribute mining, such as "Company A's Q1 2025 Financial Quarterly Report" and "Department A's June Employee Performance Appraisal Record", are converted into feature vectors by the above embedding model and then concatenated with the embedding results of the original corpus (i.e., the corresponding feature vectors obtained by converting the original corpus through the embedding model).
[0154] 2) Block embedding method. For example... Figure 4As shown, the embodiments of this application preferably employ a block embedding method and fuse the embedding results to simultaneously preserve global semantics and local details.
[0155] For each document, all dimension-attribute pairs (D i V i These are converted into natural language descriptions (e.g., "financial domain: financial statements"), which makes it easier to embed the model to encode dimension-attribute pairs, improving coding efficiency and accuracy.
[0156] Each pair (Di: Vi) is independently encoded into a block feature embedding vector V using an embedding model such as text-embedding-ada-002. chunk i .
[0157] Finally, all dimensions involved in the entire document are weighted and fused to obtain the block fusion vector.
[0158] The final block fusion vector can be expressed as: E1=Σ( w i * V chunk i ) / N, where the weight W = [ w 1, w 2, ..., w n ], w i The dimension weights corresponding to each feature dimension.
[0159] Initial stage dimension weights w i All values are 1, representing average fusion. As user data is continuously collected, the feedback mechanism in step 4 can be used for continuous adjustments. w i This strengthens the weight of a certain dimension, making the system increasingly aligned with current business concerns.
[0160] 3) By concatenating the segmented fusion vector with the embedding results of the original corpus, we obtain the feature embedding vector corresponding to the semantic attributes. The final generated feature embedding vector is E = (E1, E2), where E2 is the embedding result obtained from the original corpus through the embedding model, i.e., the feature embedding vector obtained by transforming the original corpus through the embedding model. Similarly, the feature embedding vector generated by the overall embedding method is obtained in the same way.
[0161] Finally, after generating the feature embedding vectors, an index of the feature embedding vectors is constructed using a vector database, establishing the association between the feature embedding vectors and the corresponding metadata in the original corpus. The specific vector storage method is as follows:
[0162] 1) Index building: Use a vector database (such as FAISS or Milvus) to store feature embedding vectors to support fast retrieval.
[0163] 2) Metadata association: Bind the feature embedding vector to the metadata of the original corpus (such as file path and creation time).
[0164] Figure 1 The technical solution provided in the illustrated embodiment, in step S120: after mining the semantic attributes of the original corpus corresponding to the enterprise knowledge data in the feature dimensions according to the description and division rules of the feature dimensions, and generating and storing the feature embedding vectors corresponding to the semantic attributes by combining the overall embedding method and the block embedding method with the dimension weights, further includes:
[0165] S130: When the large language model obtains a user question, it extracts the relevant feature dimensions from the user question and dynamically scales the granularity of the feature dimensions according to the retrieval requirements. It then performs feature enhancement on the scaled feature dimensions to obtain the query vector.
[0166] The technical solution provided in this application, after generating and saving the feature embedding vectors corresponding to semantic attributes, allows the large language model to perform granular scaling and feature enhancement on the feature dimensions extracted from the user question when it receives the user question, thereby obtaining a query vector. Regarding multi-dimensional feature retrieval, the purpose is to extract relevant feature dimensions, such as domain dimensions, from the user query to clarify the retrieval scope. This step includes question dimension extraction and scaling, attribute filtering, feature enhancement, and similarity retrieval. In this application embodiment, the dynamic scaling of feature dimensions controls the retrieval scope and accuracy: by expanding the extracted feature dimensions downwards or upwards, it meets the needs for different retrieval accuracy and scope. Coarse-grained dimensions increase the retrieval scope, while fine-grained dimensions increase retrieval accuracy. The retrieval requirements here, including retrieval accuracy and scope requirements, are determined by the large language model based on the user question. This application embodiment dynamically scales the granularity of feature dimensions according to retrieval requirements, performs feature enhancement on the scaled feature dimensions, and obtains a query vector to match and query enterprise knowledge data.
[0167] Specifically, as a preferred embodiment, in the above RAG retrieval optimization method, step S130: when the large language model obtains the user question, extracting the relevant feature dimensions from the user question and dynamically scaling the granularity of the feature dimensions according to the retrieval requirements, performing feature enhancement on the scaled feature dimensions to obtain the query vector, includes:
[0168] S131: Guide the large language model to extract key feature dimensions from user questions using prompt word templates. This embodiment of the application extracts domain-related dimensions from user questions. This process can be guided by prompt word templates (such as "Please extract domain, organization, and time feature dimensions from the following questions") to help the large language model identify key feature dimensions.
[0169] S132: According to the requirements of retrieval precision and retrieval scope, the relatively fine-grained key feature dimensions are expanded to a coarser-grained range, or the relatively coarse-grained key feature dimensions are expanded to a subset dimension, through the dimensional lineage graph. This application embodiment scales feature dimensions through the dimensional lineage graph to meet the needs of different retrieval precision and retrieval scope.
[0170] S133: The search scope is initially filtered based on the domain dimension involved in the user's question. This embodiment of the application performs an initial filter on the data range to be searched based on the domain dimension involved in the user's question, thereby making the search process more accurate and efficient.
[0171] S134: After the initial filtering, the domain dimension and the original user question are transformed into corresponding embedding vectors through the embedding model, and the embedding vectors are concatenated to form the query vector with enhanced features.
[0172] The technical solution provided in this application can extract relevant feature dimensions (such as domain dimensions) from user query vectors, thereby clarifying the retrieval scope and enabling large language models to retrieve the corresponding corpus more accurately and quickly. Specifically, this application includes steps such as question dimension mining, attribute filtering, feature enhancement, and similarity retrieval. Specifically combined with… Figure 3 The specific process of query vector generation and multidimensional similarity retrieval is as follows:
[0173] First, we conduct feature dimension mining of user questions. This question dimension mining involves the following steps:
[0174] 1) Dimension Extraction. Extract the domain dimensions involved from the user's questions. This process can be guided by prompt word templates (such as "Please extract domain, organization, and time feature dimensions from the following questions") to help the large language model identify key feature dimensions.
[0175] 2) Dimension scaling. By scaling the feature dimensions with granularity, the requirements of large language models for different retrieval precision and scope can be met.
[0176] Dimension scaling can be achieved by using synonyms or knowledge graphs to expand the extracted dimensions downwards or upwards (e.g., expanding "budget" to "finance"). Coarse-grained dimensions can increase the search scope, while fine-grained dimensions can increase search precision.
[0177] As a preferred embodiment, this application preferably uses a lineage expansion scheme. Based on the dimensional lineage map constructed in the above steps, the fine-grained dimensions are dynamically expanded to a coarser-grained range, or the matched coarse-grained feature dimensions are expanded to their subset dimensions.
[0178] The terms coarse-grained and fine-grained here are relative and need to be determined by the large language model based on the user's question. For example, in general, the granularity of "finance" in the feature dimension is coarse-grained, while "reimbursement" is fine-grained.
[0179] Next, attribute filtering is performed. Based on the domain dimension involved in the user's question, the range of data to be retrieved is initially filtered. Existing technologies lack cross-task knowledge integration; for example, financial documents may be incorrectly associated with production documents. To address this issue, embodiments of this application introduce attribute filtering and embedded vector retrieval, thereby improving cross-task knowledge integration capabilities.
[0180] Next, feature enhancement is performed. The domain dimension q1 that the user question may involve (e.g., "finance domain AND Company A AND Q1 2025") and the original question q2 are transformed into corresponding embedding vectors Q1 and Q2 respectively through an embedding model. The embedding vectors Q1 and Q2 are then concatenated to form a multi-dimensional feature-enhanced query vector Q = (Q1, Q2).
[0181] Finally, similarity retrieval is performed. The optimal match is found through embedding vector retrieval (e.g., FAISS similarity search).
[0182] The technical solution provided in this application controls the retrieval scope and accuracy through dynamic dimensional scaling: by expanding the extracted dimensions downwards or upwards, it meets the needs for different retrieval accuracy and scope. Coarse-grained dimensions can increase the retrieval scope, while fine-grained dimensions can increase retrieval accuracy. The generated query vector is then optimally matched with the feature embedding vector corresponding to the original corpus to obtain the matched feature embedding vector. Furthermore, this application combines attribute filtering and embedding vector retrieval, improving cross-dimensional knowledge transfer capabilities. It solves the problem in existing technologies where the lack of attribute priority ranking leads to insufficient persuasiveness and inadequate cross-task knowledge integration capabilities in recommendation tasks.
[0183] Figure 1 The technical solution provided in the illustrated embodiment, in S130: when the large language model obtains a user question, extracts the relevant feature dimensions from the user question and dynamically scales the granularity of the feature dimensions according to the retrieval requirements, performs feature enhancement on the scaled feature dimensions, and obtains the query vector, further includes:
[0184] S140: Based on the embedding vector retrieval algorithm, combined with semantic weights, find the optimal match between the query vector and the feature embedding vector to obtain the matched feature embedding vector.
[0185] The technical solution provided in this application embodiment, based on the embedding vector retrieval algorithm, combines semantic weights to find the optimal match between the query vector and the feature embedding vector, thereby realizing the retrieval of the feature embedding vector and enhancing the cross-dimensional knowledge transfer capability.
[0186] Specifically, in a preferred embodiment, step S140 above: based on the embedding vector retrieval algorithm, combined with semantic weights, finds the optimal match between the query vector and the feature embedding vector to obtain the most matching feature embedding vector, specifically including:
[0187] S141: Using the embedding vector retrieval method, calculate the feature dimension similarity and semantic similarity between the query vector and the feature embedding vector.
[0188] S142: Combining feature dimension similarity and semantic similarity, as well as the similarity weight of semantic similarity, the overall similarity between the query vector and the feature embedding vector is calculated using a weighted average.
[0189] S143: Returns the top N feature embedding vectors with the highest overall similarity.
[0190] The technical solution provided in this application finds the optimal match by performing similarity retrieval on feature embedding vectors and query vectors. Specifically, it uses similarity retrieval tools such as FAISS to calculate the overall similarity (e.g., cosine similarity) between the query vector and the corpus vectors, returning the Top-N output results. Here, the domain dimension and the original user question are transformed into corresponding embedding vectors.
[0191] The overall similarity of Sim(Q, E) is divided into two parts: the first part is the similarity in the feature dimension between the domain-dimensional embedding vector Q1 and the question's feature-dimensional embedding vector E2 (Cosine(Q1, E1)) and the semantic similarity λ * Cosine(Q2, E2) between the original question's feature vector Q2 and the original corpus's feature embedding vector E2. Specifically, Sim(Q, E) = Cosine(Q1, E1) + λ * Cosine(Q2, E2).
[0192] Figure 1 The technical solution provided in the illustrated embodiment, after step S140: finding the optimal match between the query vector and the feature embedding vector based on the embedding vector retrieval algorithm and combining semantic weights to obtain the matched feature embedding vector, further includes:
[0193] S150: Design a dynamic weight optimization mechanism to dynamically adjust the dimension weights and semantic weights based on semantic similarity and dimension frequency, respectively.
[0194] The technical solution provided in this application, by introducing a dynamic weight optimization model based on reinforcement learning, enables business-aware adaptive retrieval. The weight optimization provided in this application is real-time and targeted: it proposes a reinforcement learning weight update model based on implicit user feedback (such as click-through rate and dwell time), dynamically adjusting the weights of each feature dimension in the retrieval similarity calculation. This mechanism enables the system to automatically perceive and adapt to priority changes in different business scenarios, improving the query response speed for popular business scenarios.
[0195] Specifically, as a preferred embodiment, in the above RAG retrieval optimization method, step S150: designing a dynamic weight optimization mechanism, and using the dynamic weight optimization mechanism to dynamically adjust the dimension weights and semantic weights based on semantic similarity and dimension frequency, respectively, includes:
[0196] S151: Calculate the semantic similarity between two user questions. When the semantic similarity is higher than a predetermined similarity threshold, calculate the error-prone feature dimension.
[0197] S152: When error-prone feature dimensions are present, increase the semantic weight of semantic similarity.
[0198] S153: Determine whether the next user question contains a new feature dimension. If the next user question contains a new feature dimension, then reduce the semantic weight of semantic similarity.
[0199] S154: Online learning of feature dimension weights using a multi-armed slot machine model.
[0200] S155: Calculate the representation value of the user's clicked document on the corresponding feature dimension. When the representation value is higher than the predetermined representation threshold, generate a positive reward for the feature dimension.
[0201] S156: Use a weight update algorithm to dynamically update the dimension weights according to the positive reward.
[0202] The technical solution provided in this application calculates the semantic similarity between two user queries, automatically assesses the accuracy of the response, and adjusts the semantic weight λ of semantic similarity in the overall similarity Sim(Q, E). Typically, if a user does not receive the desired answer on their first query, they will provide more detailed information and submit a second query, which is likely to include new feature dimensions. This increases the semantic weight of semantic similarity, thereby improving retrieval accuracy. The specific steps are as follows:
[0203] 1) If the semantics of two questions asked by a user are highly similar, it is determined that the previous answer was not accurate enough. At this time, the dimensions involved in the question with the wrong answer are extracted, and the error-prone feature dimensions are statistically analyzed (the error-prone feature dimensions can be determined by the large language model or collected afterward. The error-prone feature dimensions here are the feature dimensions corresponding to the domains where errors are likely to occur, such as the feature dimensions involved in the financial domain).
[0204] 2) If a dimension is prone to errors, it is believed that more details of the question are needed for accurate querying. Therefore, the proportion of the semantic similarity between the feature vector corresponding to the question and the feature vector corresponding to the corpus in the overall similarity is increased, that is, the semantic weight λ mentioned above is increased.
[0205] 3) If the user adds feature dimensions to the question during the second query, it is determined that the newly added feature dimensions significantly affect the accuracy of the query. Therefore, the proportion of semantic similarity between the question and the corpus in the overall similarity is reduced, i.e., the semantic weight λ is reduced. The semantic weight here can be obtained through reinforcement learning.
[0206] In addition, regarding the dimensional weights of the feature dimensions, the dimensional weights are adjusted by statistically analyzing the feature dimensions involved in high-frequency responses. w i The specific steps include:
[0207] 1) Use a multi-armed slot machine model for dimension weighting. w i Online learning. Each dimension is considered an "arm". When a user executes a query and clicks on the returned result document, it is considered a positive feedback.
[0208] 2) Reward_i: If the clicked document d has a strong representation in dimension i, i.e., Cosine(V) = 1 / 2 * ... q_i V d_i If the value is high, then dimension i receives a positive reward.
[0209] 3) Weight Update: Use a weight update algorithm (e.g., EXP3 algorithm) to dynamically update the weight vector based on the obtained reward. w i .
[0210] Through the algorithm described above, the weights of high-frequency and high-contribution dimensions will be increased, thereby making the system increasingly aligned with current actual business concerns.
[0211] In summary, the RAG retrieval optimization method based on multi-dimensional enhancement provided in this application designs a hybrid guidance mechanism and conflict resolution algorithm based on prompt word templates and inter-dimensional relationships. This hybrid guidance mechanism can guide a large model to autonomously divide enterprise knowledge data into multi-level and multi-granularity feature dimensions. The conflict resolution algorithm can fuse or expand feature dimensions according to inter-dimensional relationships. This allows for hybrid initialization and incremental expansion of feature dimensions through a combination of "autonomous division by the large model" and "business expert adjudication." Then, based on the feature dimension description and division rules, the semantic attributes of the original corpus corresponding to the enterprise knowledge data on the feature dimensions are mined. Using a combination of holistic embedding and block embedding methods, and combined with dimension weights, feature embedding vectors corresponding to the semantic attributes are generated and stored. This method solves the problems of fine-grained information loss in holistic embedding and semantic fragmentation in single block embedding in existing technologies, thereby improving accuracy in cross-task retrieval scenarios. When the large language model receives a user question, it extracts the relevant feature dimensions from the question and dynamically scales the granularity of these feature dimensions according to retrieval requirements. The scaled feature dimensions are then augmented to obtain a query vector. This allows for scaling the feature dimensions to meet different retrieval precision and scope requirements. Finally, based on the embedding vector retrieval algorithm and semantic weights, the optimal match between the query vector and the feature embedding vector is found, resulting in the matched feature embedding vector. After obtaining the matched feature embedding vector, this application also involves a dynamic weight optimization mechanism. In this mechanism, dimension weights and semantic weights are dynamically adjusted based on semantic similarity and dimension frequency, enabling the entire system to automatically perceive and adapt to priority changes in different business scenarios, achieving business-aware adaptive retrieval. In summary, the above technical solution addresses the problems of existing technologies in processing multi-source heterogeneous enterprise knowledge data, where dimension segmentation relies on manual methods, lacks automation and consistency guarantees, leading to low information retrieval efficiency and insufficient cross-task knowledge transfer capabilities.
[0212] See Figure 2 , Figure 2 A flowchart illustrating a second RAG retrieval optimization method based on multi-dimensional enhancement is provided for embodiments of this application. For example... Figure 2 As shown, the RAG retrieval optimization method includes:
[0213] S210: Multi-granularity feature dimension partitioning: Combining actual enterprise needs, the original corpus is divided into multiple levels of dimensions through large-scale model self-partitioning and business expert expertise, and supports dynamic expansion and merging of sub-dimensions.
[0214] S220: Feature Attribute Mining and Structured Labeling: Based on the partitioned dimensional framework, the large model is guided by prompt words to extract the attribute values of the original corpus in each dimension, forming multi-dimensional labels, supporting the association of multiple dimensions with the same corpus.
[0215] S230: Feature Embedding and Vector Storage: The structured attribute results are converted into feature vectors through an embedding model, and then concatenated with the original corpus vectors using either whole embedding or block embedding methods, and stored in a vector database.
[0216] S240: Multidimensional retrieval and dynamic optimization: Extract key dimensions from user queries, combine attribute filtering, dimension scaling and embedded vector retrieval to match the optimal results, and optimize retrieval performance by dynamically adjusting dimension weights and user feedback.
[0217] Furthermore, the beneficial effects of the product embodiments provided in the following embodiments of this application are the same as the beneficial effects of the RAG retrieval optimization method based on multi-dimensional enhancement provided in the above embodiments, and other technical features in the product embodiments are the same as the features disclosed in the methods of the above embodiments, and will not be repeated here.
[0218] See Figure 5 , Figure 5 This is an overall architecture diagram of a retrieval optimization system based on multi-dimensional feature enhancement, provided for embodiments of this application. (See diagram below.) Figure 5 As shown, the retrieval optimization system based on multidimensional feature enhancement includes:
[0219] The module comprises a dimension management module 110, a feature embedding module 120, a multidimensional retrieval module 130, and a feedback learning module 140; among which,
[0220] Dimension management module 110 includes a hybrid guidance mechanism 111, a drift detection submodule 112, and a dimensional lineage map 113;
[0221] The feature embedding module 120 includes a block embedding submodule 121, a global fusion submodule 122, and a vector storage submodule 123;
[0222] The multidimensional retrieval module 130 includes a multidimensional matching submodule 131 and a dimension scaling submodule 132;
[0223] The feedback learning module 140 includes a dimension weight submodule 141 and a semantic weight submodule 142.
[0224] Specifically, the dimension management module 110 is used for automated dimension partitioning and conflict resolution. Its goal is to divide the raw data (reports, regulations, etc.) required for normal company operation into multi-level, multi-granularity feature dimensions, based on the company's actual operational needs, providing a structured framework for subsequent feature mining and retrieval. The hybrid guidance mechanism 111 mainly guides large models (such as GPT-4 and Tongyi Qianwen) to extract dimensions from the raw data through prompt word templates. The prompt word design should consider iterative processing capabilities, supporting step-by-step processing of large datasets, temporary storage of intermediate results, and incremental updates. The drift detection submodule 112 is used for dimension semantic coordinate drift detection. The dimension lineage graph 113 is used to record the operation type, operator, operation time, and triggering conditions (drift Δ value or threshold trigger) when dimension Di is split into sub-dimensions {Di1, Di2, ...} or merged; it stores lineage graph nodes (dimensions) and edges (split / merge events); additionally, it provides a "dimensional evolution dashboard" on the system UI side, supporting the viewing of the historical evolution trajectory of any dimension.
[0225] The feature embedding module 120 supports the mining and embedding of feature attributes; its goal is to map the original corpus to specific dimensions, extract its attribute values, and form structured labels. The block embedding submodule 121 fuses the embedding results using a block embedding method to simultaneously preserve global semantics and local details. The global fusion submodule 122 uses a holistic embedding method to achieve the overall concatenation of the overall feature vector with the embedding results corresponding to the original corpus. The vector storage submodule 123 stores and indexes the feature embedding vectors.
[0226] The multidimensional retrieval module 130 is used for multidimensional feature retrieval, aiming to extract the relevant dimensions from the user query and clarify the retrieval scope. It includes a multidimensional matching submodule 131 and a dimension scaling submodule 132.
[0227] The feedback learning module 140 consists of two parts: a dimension weight submodule 141 and a semantic weight submodule 142, which can realize the dynamic updating of dimension weights and semantic weights.
[0228] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the RAG retrieval optimization method based on multi-dimensional enhancement provided in any of the above embodiments.
[0229] like Figure 6As shown, the electronic device can include a processing unit 1001, such as a central processing unit and / or a graphics processing unit, which can perform various appropriate actions and processes according to a program stored in ROM 1002 or a program loaded from storage device 1003 into RAM 1004. RAM 1004 also stores various programs and data required for the operation of the electronic device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output interface 1006 is also connected to bus 1005. Typically, the following systems can be connected to input / output interface 1006: input devices 1007, such as touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, and / or gyroscopes; output devices 1008, such as liquid crystal displays (LCDs), speakers, and / or vibrators; storage devices 1003, such as magnetic tape and / or hard disks; and communication devices 1009. Communication device 1009 is capable of enabling the electronic device to exchange data with other devices wirelessly or via wired communication. Although the diagram shows a model building device with various systems, it should be understood that it is not required to implement or have all of the systems shown. It is possible to implement or have more or fewer systems alternatively.
[0230] Specifically, according to the embodiments disclosed in this application, the processes described in the above-mentioned flowcharts can be implemented as computer software programs. Embodiments of this application also provide a computer-readable storage medium having computer-readable program instructions stored thereon, i.e., the aforementioned computer program, which is used to execute the multi-dimensional enhancement-based RAG retrieval optimization method in the above embodiments. The aforementioned computer-readable storage medium carries one or more programs, and when these programs are executed by a model-building device, computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof.
[0231] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram can represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or can be implemented using a combination of dedicated hardware and computer instructions.
[0232] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0233] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.
[0234] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for RAG retrieval optimization based on multi-dimension enhancement, characterized in that, include: Based on prompt word templates and inter-dimensional relationships, a hybrid guidance mechanism and conflict resolution algorithm are designed. Using the hybrid guidance mechanism and conflict resolution algorithm, the large model is guided to automatically divide enterprise knowledge data into multi-level and multi-granularity feature dimensions, and the feature dimensions are fused or expanded according to the inter-dimensional relationships. Based on the description and division rules of the feature dimensions, the semantic attributes of the original corpus corresponding to the enterprise knowledge data on the feature dimensions are mined. The feature embedding vectors corresponding to the semantic attributes are generated and stored by combining the overall embedding method and the block embedding method with the dimension weights. When the large language model obtains a user question, it extracts the relevant feature dimensions from the user question and dynamically scales the granularity of the feature dimensions according to the retrieval requirements. It then performs feature enhancement on the scaled feature dimensions to obtain the query vector. Based on the embedding vector retrieval algorithm, combined with semantic weights, the optimal match between the query vector and the feature embedding vector is found, and the most matching feature embedding vector is obtained. A dynamic weight optimization mechanism is designed, which dynamically adjusts the dimension weight and semantic weight based on semantic similarity and dimension frequency, respectively.
2. The method as described in claim 1, characterized in that, The steps of designing a hybrid guidance mechanism and conflict resolution algorithm based on prompt word templates and inter-dimensional relationships, guiding the large model to automatically divide enterprise knowledge data into multi-level, multi-granularity feature dimensions according to the hybrid guidance mechanism and conflict resolution algorithm, and fusing or expanding the feature dimensions according to the inter-dimensional relationships, include: Design prompt word templates and use the prompt word templates to guide the large language model to extract multiple feature dimensions from the original corpus corresponding to the enterprise knowledge data; Detect the semantic coordinate drift of each fixed feature dimension in the multi-feature dimension, and fuse or split the feature dimensions according to the semantic coordinate drift. By preserving the interdimensional relationships and historical evolutionary trajectories between the feature dimensions of fusion or splitting, a dimensional lineage map is obtained; Combining the dimensional lineage map and the prompt word template, descriptive partitioning rules are written for each feature dimension.
3. The method as described in claim 2, characterized in that, The design prompt word template, and the steps of using the prompt word template to guide the large language model to extract multi-dimensional features from the original corpus corresponding to the enterprise knowledge data, include: Construct a domain-dimensional framework and add resource description information corresponding to the original corpus; When the newly added resource description information cannot match the existing feature dimensions of the domain dimension framework, it is assigned to a new feature dimension according to the core function of the resource through a coarse-grained attribution method. Alternatively, when the original corpus corresponding to the existing feature dimension exceeds a predetermined number of items, the feature dimension is split into multiple sub-dimensions through a dimension splitting method; Establish a hierarchical relationship diagram between different feature dimensions in the domain dimension framework, and construct a cross-dimensional resource pool based on the different feature dimensions to which the same original corpus belongs.
4. The method as described in claim 2, characterized in that, The step of detecting the semantic coordinate drift of each fixed feature dimension in the multi-feature dimensions, and fusing or splitting the feature dimensions based on the semantic coordinate drift, includes: Based on the feature embedding vectors of the most recent documents under the fixed feature dimension, the semantic centroid vector of the feature dimension is maintained by the embedding model; When a new document is classified into the feature dimension by the large language model, the semantic difference between the semantic centroid vector of the feature dimension and the feature embedding vector of the new document is calculated. When the semantic difference is greater than a predetermined difference threshold, it is determined that the feature dimension has a semantic coordinate drift. The first triplet is constructed using the semantic difference, the new document, and the feature dimension. The first triplet is then pushed to the business expert or the expert experience model. The feature dimension is split or the semantic centroid vector is replaced according to the feedback result of the business expert or the expert experience model. Calculate the semantic difference degree between the semantic centroid vectors of two adjacent feature dimensions. When the semantic difference degree is greater than the predetermined difference threshold, construct a second triplet using the semantic difference degree and the two adjacent feature dimensions and push it to the business expert or expert experience model. Selectively fuse the two adjacent feature dimensions based on the feedback results of the business expert or expert experience model.
5. The method as described in claim 1, characterized in that, Based on the description and partitioning rules of the feature dimensions, the semantic attributes of the original corpus corresponding to the enterprise knowledge data on the feature dimensions are mined. The steps of generating and storing the feature embedding vectors corresponding to the semantic attributes, using a combination of holistic embedding and segmented embedding methods and combining dimension weights, include: The prompt word template guides the large language model to extract the semantic attributes of the original corpus on different feature dimensions according to the description and division rules of the feature dimensions. In the holistic embedding method, an embedding model is used to convert all semantic attributes corresponding to the original corpus into a holistic embedding vector, and the holistic embedding vector is concatenated with the embedding result of the original corpus to obtain the feature embedding vector corresponding to the semantic attribute. In the segmented embedding method, all dimension-attribute pairs of the same document are converted into natural language descriptions respectively; In conjunction with the natural language description, the embedding model is used to independently encode each dimension-attribute pair into a block feature embedding vector; According to the dimension weights corresponding to the feature dimensions, all block feature embedding vectors in the same document are weighted and fused to obtain a block fusion vector. By concatenating the segmented fusion vector with the embedding result of the original corpus, the feature embedding vector corresponding to the semantic attribute is obtained; An index of the feature embedding vectors is constructed using a vector database, and the association between the feature embedding vectors and the corresponding metadata in the original corpus is established.
6. The method as described in claim 5, characterized in that, The steps of extracting relevant feature dimensions from the user question when the large language model obtains the query vector, dynamically scaling the granularity of the feature dimensions according to the retrieval requirements, and performing feature enhancement on the scaled feature dimensions to obtain the query vector include: The prompt word template guides the large language model to extract key feature dimensions from the user's question; Based on the requirements of retrieval accuracy and retrieval scope, the relatively fine-grained key feature dimensions can be expanded to a coarser-grained range through the dimensional lineage map, or the relatively coarse-grained key feature dimensions can be expanded to a subset dimension. The search scope is initially filtered based on the domain dimensions involved in the user's question; After the initial filtering, the domain dimension and the original user question are transformed into corresponding embedding vectors through the embedding model, and the embedding vectors are concatenated to form a query vector with enhanced features.
7. The method as described in claim 6, characterized in that, The step of finding the optimal match between the query vector and the feature embedding vector based on the embedding vector retrieval algorithm and semantic weights to obtain the most matching feature embedding vector includes: Using the embedding vector retrieval method, the feature dimension similarity and semantic similarity between the query vector and the feature embedding vector are calculated; By combining the feature dimension similarity and semantic similarity, as well as the similarity weight of the semantic similarity, the overall similarity between the query vector and the feature embedding vector is calculated using a weighted average. Return the top N feature embedding vectors with the highest overall similarity as the best matching feature embedding vector.
8. The method as described in claim 1 or 7, characterized in that, The design of the dynamic weight optimization mechanism, which dynamically adjusts the dimensional weights and semantic weights based on semantic similarity and dimensional frequency, includes the following steps: Calculate the semantic similarity between two user questions, and when the semantic similarity is higher than a predetermined similarity threshold, count the error-prone feature dimension. When error-prone feature dimensions appear, the semantic weight of the semantic similarity is increased; Determine whether the subsequent user question contains a new feature dimension. If the subsequent user question contains a new feature dimension, then reduce the semantic weight of the semantic similarity. The dimensional weights of the aforementioned feature dimensions are learned online using a multi-armed slot machine model; Calculate the representation value of the user's clicked document on the corresponding feature dimension, and generate a positive reward for the feature dimension when the representation value is higher than a predetermined representation threshold; The dimension weights are dynamically updated using a weight update algorithm based on the positive reward.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the RAG retrieval optimization method based on multi-dimensional enhancement as described in any one of claims 1 to 8.
10. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the RAG retrieval optimization method based on multi-dimensional enhancement as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Enhanced document generation and retrieval method based on knowledge graph
CN119646178A
Enhanced generation method based on question matching retrieval
CN120611021A