Search enhancement generation method fusing dynamic adaptive hinting project and semantic enhancement

By semantically enhancing and vectorizing the knowledge base in the field of college admissions consultation, and using dynamic adaptive prompting engineering to transform queries, the problems of insufficient query understanding, data processing and system robustness in existing technologies are solved, and more accurate and logically coherent intelligent question answering is achieved.

CN121166733BActive Publication Date: 2026-02-17浙江航大科技开发有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511695194.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-02-17
Estimated Expiration
2045-11-19

AI Technical Summary

Technical Problem

Existing search enhancement generation technologies suffer from problems such as insufficient query understanding, rough data processing, inadequate system robustness, and rigid reasoning guidance in specific fields such as college admissions consultation, resulting in low accuracy and poor robustness of answers.

Method used

We employ a method that integrates dynamic adaptive suggestion engineering and semantic enhancement to perform offline semantic enhancement preprocessing and vectorization on the target domain knowledge base. By using query rewriting nodes, we convert natural language queries into structured subqueries, dynamically select processing paths, and combine parallel retrieval from multiple knowledge bases with context aggregation to generate accurate answers.

Benefits of technology

It significantly improves the accuracy of query intent recognition, avoids retrieval bias from high-frequency word queries, enhances the robustness of the system and the logical coherence of the answers, and provides an intelligent interactive experience comparable to or even surpassing that of real experts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166733B_ABST
    Figure CN121166733B_ABST
Patent Text Reader

Abstract

The application discloses a retrieval enhancement generation method fusing dynamic adaptive prompt engineering and semantic enhancement, and relates to the technical field of intelligent question answering. The method comprises the following steps: performing semantic enhancement preprocessing on original data in a target domain knowledge base; performing vectorization on the enhanced data and constructing a corresponding vector knowledge base; after receiving a user natural language query, converting the query into a structured subquery through a preset prompt engineering; judging whether the structured subquery contains preset high-frequency words and selecting a corresponding processing path to construct a context; and generating a target answer based on the context and the original query. The application solves the problem of "semantic sparsity" of data through semantic enhancement, realizes accurate intent understanding through query rewriting, and avoids high-frequency word retrieval bias through dynamic path selection, thereby significantly improving the intelligent question answering quality in specific fields such as college enrollment consultation, and enhancing the robustness and adaptive ability of the intelligent question answering system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of intelligent question answering, in particular to a retrieval enhancement generation method fusing dynamic adaptive prompting engineering and semantic enhancement, and is especially suitable for intelligent question answering scenarios in professional and data-intensive fields such as college enrollment consultation. BACKGROUND

[0002] In recent years, large language models (LLMs) have shown excellent capabilities in natural language processing. However, due to their core capabilities being derived from pre-training on massive static data sets, there are two major limitations in internal knowledge: on the one hand, they cannot learn new information after the training cutoff date; on the other hand, the knowledge learned from general-purpose corpora cannot meet the requirements of specific domains for information accuracy and depth. In addition, without external fact constraints, large language models are prone to produce "hallucination" content that is inconsistent with facts.

[0003] To solve the above problems, retrieval-augmented generation (RAG) technology has emerged as the mainstream paradigm for adapting large language models to specific tasks. The core idea of RAG is to retrieve relevant information segments from an external knowledge base as instant context and provide them to the language model before model inference and generation. By combining the generation capabilities of large language models with the real-time and accuracy of external knowledge sources, RAG improves the consistency of factual answers, reduces "hallucinations", and avoids the high cost of model retraining. A typical RAG system includes three core components: a retriever, an augmenter, and a generator. The retriever is responsible for querying information from the knowledge base, the augmenter is responsible for processing, filtering, and integrating the retrieved information to match the query context, and the generator generates coherent and accurate answers by combining the original query and the enhanced context.

[0004] RAG technology has gone through several stages of development: the initial "naive RAG" used traditional sparse retrieval methods such as TF-IDF or BM25 to match keywords from static text datasets. Although simple to implement, it lacked context awareness, resulting in insufficient relevance of search results and fragmented and generalized generated answers, performing poorly on large-scale datasets; "advanced RAG" introduced dense vector retrieval, context rearrangement, and multi-hop retrieval capabilities, improving semantic understanding and retrieval accuracy, but suffered from high computational overhead for dense vectors and a rigid "retrieval-generation" pipeline when dealing with complex queries requiring multiple steps and cross-domain knowledge; "modular RAG" emphasized system flexibility, composability, and scalability, adopting hybrid retrieval strategies and integrating external tools, but failed to achieve deep collaboration between "data-query-suggestion." In scenarios such as college admissions consultation, when faced with fuzzy queries (such as "Can someone with a physics score of 450 in Province A apply for an artificial intelligence major?"), problems such as insufficient query understanding, retrieval bias, and low answer accuracy still exist.

[0005] In specific areas such as college admissions counseling, existing RAG methods have significant shortcomings:

[0006] At the query comprehension level: users’ colloquial and incomplete fuzzy queries are processed by a single vector, which fails to break down potential multi-dimensional information needs, resulting in a lack of targeted search results;

[0007] At the data processing level: the raw data is processed roughly, and there is a lack of coordination with the prompting project. The "semantic sparsity" of the raw data and the similarity vector problem after the structured table is converted lead to a "semantic misalignment" between the query intent and the data representation.

[0008] System robustness: High-frequency words in a specific domain knowledge base are prone to causing retrieval bias. That is, when a user queries a high-frequency word in the knowledge base, the system may incorrectly recall other irrelevant entries containing the high-frequency word due to the proximity interference in the vector space, which seriously pollutes the context of the generative model and ultimately leads to incorrect answers.

[0009] At the reasoning guidance level: the existing fixed static prompt word templates cannot be dynamically adjusted according to the query type, the complex structure of the search results, or specific states identified by the internal process of the system (such as potential search bias), which greatly limits the quality and adaptability of the final generated answer.

[0010] Therefore, there is an urgent need for a retrieval enhancement generation method that can solve the deep-seated problems of existing technologies in the four core dimensions of query understanding, data processing, system robustness, and reasoning guidance. Summary of the Invention

[0011] This application aims to address the problems of existing retrieval enhancement generation technologies, such as insufficient query understanding, rough data processing, inadequate system robustness, and rigid reasoning guidance. It provides a retrieval enhancement generation method that integrates dynamic adaptive prompting engineering and semantic enhancement to improve the quality of intelligent question answering in specific fields such as college admissions consultation.

[0012] The above-mentioned objective of this application is achieved through the following technical solution:

[0013] A retrieval enhancement generation method integrating dynamic adaptive suggestion engineering and semantic enhancement, the method comprising the following steps:

[0014] Offline semantic enhancement preprocessing is performed on the raw data in the target domain knowledge base;

[0015] The data that has undergone semantic enhancement preprocessing is processed offline into vectors, and corresponding vector knowledge bases are built according to data type and purpose. The vectorized data is then stored in the corresponding vector knowledge bases.

[0016] When a natural language query is received from a user, the natural language query is converted into a structured subquery through a preset query rewriting node. The natural language query is an unstructured query in a specific scenario of the target domain.

[0017] Determine whether the structured subquery contains preset high-frequency words, and obtain the high-frequency word determination result;

[0018] Based on the high-frequency word judgment results, the corresponding processing path is selected, and a context is constructed based on the structured subquery;

[0019] The target answer is generated based on the context and the natural language query.

[0020] Preferably, the semantic enhancement preprocessing includes:

[0021] For unstructured text data, a large language model is used to generate keywords based on the text data, and the keywords are concatenated with the original text to form enhanced data;

[0022] For structured tabular data, each row of data in the table is first converted into an independent text line according to a preset text conversion template. Then, keywords are generated for each text line using a large language model, and the keywords are concatenated with the corresponding text lines to form enhanced data.

[0023] Preferably, the preset text conversion template is a key-value pair format of column name: cell value.

[0024] Preferably, the step of converting the natural language query into a structured subquery through a preset query rewriting node includes:

[0025] Obtain the natural language query input by the user;

[0026] The natural language query is input into a large language model configured with a preset suggestion project, wherein the preset suggestion project is a dedicated suggestion strategy designed for a specific scenario in the target domain;

[0027] The preset prompting process guides the large language model to deconstruct the intent, extract elements, and reconstruct the format of the natural language query, outputting a structured subquery that is adapted to the data representation of the target domain knowledge base.

[0028] Preferably, the preset prompting project includes a format constraint module, an example training module, and an intent guidance module, wherein,

[0029] The format constraint module is used to limit the output format and field naming rules of structured subqueries;

[0030] The example training module is used to provide labeled natural language query-structured subquery sample pairs;

[0031] The intent guidance module is used to instruct the large language model to identify the core requirements in natural language queries.

[0032] Preferably, the output format of the structured subquery is JSON format. The JSON-formatted structured subquery includes a search matching field and an attribute tag field. The search matching field is used to accurately point to the data category in the target domain knowledge base, and the attribute tag field is used to identify whether the natural language query contains preset high-frequency words.

[0033] Preferably, the step of selecting the corresponding processing path based on the high-frequency word judgment result and constructing the context based on the structured subquery includes:

[0034] When the high-frequency word judgment result indicates that the structured subquery contains preset high-frequency words, the high-frequency word adaptive processing path is selected to construct a context based on the structured subquery;

[0035] When the high-frequency word judgment result indicates that the structured subquery does not contain the preset high-frequency words, the conventional processing path is selected to construct a context based on the structured subquery.

[0036] Preferably, constructing the context based on the structured subquery through the high-frequency word adaptive processing path includes:

[0037] Hard-coded data is obtained by hard-coding the data corresponding to preset high-frequency words into the prompt words.

[0038] Parse the structured subquery in JSON format and extract the search matching fields corresponding to each vector knowledge base;

[0039] Based on the extracted search matching fields, search requests are sent to each vector knowledge base simultaneously and search results are obtained.

[0040] The hard-coded data and the search results are aggregated together to form a context.

[0041] Preferably, constructing a context based on the structured subquery through a conventional processing path includes:

[0042] Parse the structured subquery in JSON format and extract the search matching fields corresponding to each vector knowledge base;

[0043] Based on the extracted search matching fields, search requests are sent to each vector knowledge base simultaneously and search results are obtained.

[0044] The search results are aggregated into context.

[0045] Preferably, generating the target answer based on the context and the natural language query includes:

[0046] The context and the natural language query are input into a preset generative model, and the target answer is output. The generative model is a large language model that has been fine-tuned with target domain data.

[0047] This application's retrieval enhancement generation method, which integrates dynamic adaptive prompting engineering and semantic enhancement, optimizes data representation through semantic enhancement preprocessing and combines it with precise matching of structured subqueries. This solves the "semantic misalignment" problem between query intent and data representation in existing technologies, significantly improving retrieval accuracy. The dynamic adaptive path effectively identifies and processes high-frequency word queries, avoids retrieval bias by hard-coding authoritative data, reduces answer errors caused by uneven data distribution, and enhances system robustness. Parallel retrieval from multiple knowledge bases and contextual aggregation provide comprehensive support for the generation model. Combined with dynamic prompting guidance, this effectively optimizes answer quality, making answers more accurate, logically coherent, and meeting the needs of specific professional fields. The core architecture of this method can be flexibly adapted to other professional fields such as medicine and finance. Cross-domain applications can be achieved simply by replacing the corresponding knowledge base data and fine-tuning the generation model. Attached Figure Description

[0048] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0049] Figure 1 This is a flowchart illustrating a retrieval enhancement generation method that integrates dynamic adaptive suggestion engineering and semantic enhancement in an embodiment of this application.

[0050] Figure 2 This is a logical block diagram of a retrieval enhancement generation method that integrates dynamic adaptive prompting engineering and semantic enhancement in an embodiment of this application. Detailed Implementation

[0051] To enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0052] In the embodiments provided in this application, it should be understood that the disclosed methods and systems can be implemented in other ways. The system embodiments described below are merely illustrative. For example, the division of units and modules is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or modules can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, and can be electrical, mechanical, or other forms.

[0053] In addition, each functional unit in the various embodiments of this application can be integrated into a single processor, or each unit can be a separate device, or two or more units can be integrated into a single device; each functional unit in the various embodiments of this application can be implemented in hardware or in the form of hardware plus software functional units.

[0054] Those skilled in the art will understand that all or part of the steps of the following method embodiments can be implemented by program instructions and related hardware. The aforementioned program instructions can be stored in a computer-readable storage medium. When the program instructions are executed, they perform the steps of the following method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0055] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "a plurality of" or "several" means two or more, unless otherwise explicitly specified.

[0056] In specific fields such as college admissions consultation, existing RAG methods have the following significant shortcomings: At the query understanding level, user-conversational and incomplete fuzzy queries are processed using a single vectorization, failing to decompose potential multi-dimensional information needs, resulting in a lack of targeted search results; at the data processing level, the raw data is processed crudely, lacking coordination with the prompting engineering. The "semantic sparsity" of the raw data and the similarity vector problem after the transformation of structured tables lead to a "semantic misalignment" between query intent and data representation; at the system robustness level, high-frequency words in specific domain knowledge bases are prone to causing search bias. That is, when a user queries high-frequency words in the knowledge base, the system may incorrectly recall other irrelevant entries containing the high-frequency words due to proximity interference in the vector space, thus seriously polluting the context of the generative model and ultimately leading to incorrect answers; at the reasoning guidance level, existing fixed static prompt word templates cannot be dynamically adjusted according to query type, the complex structure of search results, or specific states identified by the system's internal processes (such as potential search bias), thus greatly limiting the quality and adaptability of the final generated answer.

[0057] To address the deep-seated problems of existing technologies in the four core dimensions of query understanding, data processing, system robustness, and reasoning guidance, the primary objective of this application is to provide an innovative retrieval enhancement generation method that integrates dynamic adaptive prompting engineering and semantic enhancement. The ultimate goal of this application is to construct a next-generation RAG question-answering solution capable of deeply understanding the complex, multi-dimensional intents of users, efficiently processing heterogeneous data through collaborative design, proactively identifying and avoiding inherent biases in the retrieval process, and performing intelligent, adaptive reasoning. This application aims to significantly improve the accuracy, factual consistency, and system robustness of RAG systems in complex professional fields such as college admissions consultation, enabling users to obtain an intelligent interactive experience comparable to or even surpassing that of human experts.

[0058] To achieve the above objectives, this application proposes a complete and innovative technical solution. Its core lies in the deep integration and dynamic collaboration of data processing and model inference through a multi-node collaborative workflow. To address the shallow nature of query understanding, this application designs a query rewriting and multi-dimensional expansion node to intelligently decompose the user's fuzzy query. To solve the problem of coarse data processing and its disconnect from suggestion engineering, this application improves the signal-to-noise ratio and readability of the knowledge source through semantic enhancement preprocessing. To overcome the system robustness challenge and break the static deadlock of reasoning guidance, this application introduces a dynamic and adaptive context fusion and suggestion engineering mechanism. This mechanism can proactively identify specific triggering conditions in the query (such as potential biased keywords) and reconstruct the context by forcibly injecting high-weight authoritative data. Simultaneously, it strategically switches suggestion words in the generation stage to guide the large language model to perform more reliable and targeted reasoning. Through this series of interconnected and corresponding innovative designs, this application aims to fundamentally solve many shortcomings of existing technologies.

[0059] Traditional RAGs employ a simple "retrieval-generation" model. The ambiguity of query intent and the coarseness of data representation often lead to "semantic misalignment" in the retrieval stage. Furthermore, static suggestion engineering lacks flexibility and context awareness, failing to correct upstream errors. For example... Figure 2 As shown, this application optimizes the query end and data end through "query rewriting" and "semantic enhancement" respectively, and introduces a "dynamic adaptive suggestion" node, which enables collaborative decision-making based on the original query and retrieval content, thereby improving the robustness and reasoning flexibility of the system and enhancing the answer quality of the RAG system.

[0060] This application addresses the challenges faced by existing retrieval enhancement generation methods in handling complex domain question answering through a multi-node workflow that deeply integrates and dynamically coordinates data processing and model inference. First, it optimizes the data representation of the knowledge base using an innovative semantic enhancement method. Then, it utilizes a query rewriting node based on suggestion engineering to transform the user's fuzzy query into structured subqueries targeting different data sources. Furthermore, this application introduces a dynamically adaptive suggestion engineering mechanism that intelligently selects the optimal execution path and context construction strategy based on the specific attributes of the query content. This effectively avoids robustness issues caused by long-tail data distribution while ensuring information retrieval accuracy. This series of collaborative design innovations significantly improves the accuracy, robustness, and intelligence of the RAG system when handling complex, multi-dimensional queries.

[0061] like Figure 1 As shown in the embodiments of this application, a retrieval enhancement generation method integrating dynamic adaptive suggestion engineering and semantic enhancement is provided. This method may include the following steps:

[0062] S1, performs offline semantic enhancement preprocessing on the raw data in the target domain knowledge base;

[0063] S2 performs offline vectorization processing on the data after semantic enhancement preprocessing, and constructs corresponding vector knowledge bases according to data type and purpose, storing the vectorized data into the corresponding vector knowledge bases respectively.

[0064] S3, when a natural language query is received from the user, the natural language query is converted into a structured subquery through a preset query rewriting node. The natural language query is an unstructured query in a specific scenario of the target domain.

[0065] S4, determine whether the structured subquery contains preset high-frequency words, and obtain the high-frequency word judgment result;

[0066] S5, select the corresponding processing path based on the high-frequency word judgment result and construct the context based on the structured subquery;

[0067] S6 generates the target answer based on context and natural language queries.

[0068] This application provides a retrieval enhancement generation method that integrates dynamic adaptive suggestion engineering and semantic enhancement. First, the original data in the target domain knowledge base undergoes offline semantic enhancement preprocessing. Then, the semantically enhanced preprocessed data is vectorized offline, and a corresponding vector knowledge base is constructed based on data type and purpose. The vectorized data is stored in the corresponding vector knowledge base. Next, when a natural language query is received from a user, it is converted into a structured subquery through a preset query rewriting node. Then, it is determined whether the structured subquery contains preset high-frequency words, obtaining the high-frequency word judgment result. Next, based on the high-frequency word judgment result, the corresponding processing path is selected to construct a context based on the structured subquery. Finally, the target answer is generated based on the context and the natural language query.

[0069] In summary, the embodiments of this application optimize data representation through semantic enhancement preprocessing, convert natural language queries into structured subqueries to achieve accurate matching, and combine high-frequency word judgment to select a dynamic processing path, ultimately generating the target answer. The solution of the embodiments of this application constructs a complete technical framework of "data enhancement - query understanding - dynamic retrieval - intelligent generation", which solves the shortcomings of traditional RAG in four core dimensions: query understanding, data processing, system robustness, and reasoning guidance, and improves the accuracy and robustness of intelligent question answering systems as a whole.

[0070] Specifically, the large language model in this embodiment is selected from any one of the GPT series, LLaMA series, or ERNIE series.

[0071] It should be noted that steps S1 and S2 in this embodiment are preparation steps. These two steps are completed offline, reducing network usage during the query process. In the process of processing user queries, only steps S3-S6 need to be executed, which effectively improves query efficiency.

[0072] In step S2, the specific processing procedure is as follows: all data after semantic enhancement is converted into vector form through a vector encoding model, and stored in the corresponding vector knowledge base according to the source and type of the data. In the field of college admissions consultation, a multi-source heterogeneous vector knowledge base system can be constructed, which includes at least an admissions Q&A knowledge base, a college entrance examination score distribution table knowledge base, a historical admissions information knowledge base, and a current year's admissions plan knowledge base.

[0073] It should be noted that the target domain knowledge base in step S1 refers to a knowledge base in a specific domain such as college admissions consultation.

[0074] In one embodiment, semantic enhancement preprocessing includes:

[0075] For unstructured text data, a large language model is used to generate keywords based on the text data, and the keywords are concatenated with the original text to form augmented data;

[0076] For structured tabular data, each row of data in the table is first converted into an independent text line according to a preset text conversion template. Then, keywords are generated for each text line using a large language model, and the keywords are concatenated with the corresponding text lines to form augmented data.

[0077] In this embodiment, differentiated enhancement strategies are designed for different types of data. For unstructured text data (such as college admission Q&A content), each piece of original data is input into a large language model, which generates a set of keywords summarizing the core content according to preset instructions. The keywords are then concatenated with the original text to form semantically enhanced unstructured data. For structured tabular data (such as college entrance examination score distribution tables and historical admission data tables), each row in the table is first converted into an independent text record according to a preset text conversion template. Then, the same semantic enhancement operation as for unstructured text is performed on each text record, that is, keywords are generated by the large language model and concatenated with the original text to form semantically enhanced structured data, which strengthens the semantic features of the data, enriches the semantic information of the original data, solves the "semantic sparsity" problem, and effectively improves the matching accuracy of query data.

[0078] In one embodiment, the preset text conversion template is a key-value pair format of column name: cell value.

[0079] This embodiment uses a key-value pair format of "column name: cell value" to textify the table data, preserving data structure information, avoiding information loss after structured data conversion, and effectively improving the semantic matching degree between table data and queries.

[0080] In one embodiment, converting a natural language query into a structured subquery via a preset query rewriting node includes:

[0081] Obtain the natural language query input by the user;

[0082] The natural language query is input into a large language model configured with a preset suggestion engineering, which is a dedicated suggestion strategy designed for specific scenarios in the target domain;

[0083] By using a pre-defined prompting engineering approach, the large language model is guided to deconstruct the intent of natural language queries, extract elements, and reconstruct the format, outputting structured subqueries that are adapted to the data representation of the target domain knowledge base.

[0084] This embodiment utilizes a pre-defined prompt engineering-guided large language model to perform deep analysis of natural language queries, converting them into structured subqueries. This structured approach enables precise breakdown of multi-dimensional needs, effectively improving the accuracy of query intent recognition.

[0085] In one embodiment, the preset prompting project includes a format constraint module, an example training module, and an intent guidance module, wherein...

[0086] The format constraint module is used to limit the output format and field naming rules of structured subqueries;

[0087] The example training module provides labeled natural language query-structured subquery sample pairs;

[0088] The intent guidance module is used to instruct the large language model to recognize the core requirements in natural language queries.

[0089] This embodiment, through the synergistic effect of the format constraint module, example training module, and intent guidance module, greatly improves the format standardization of structured subqueries and the completeness of core element extraction, ensuring the quality of query rewriting.

[0090] In one embodiment, the output format of the structured subquery is JSON format. The JSON format structured subquery includes a search matching field and an attribute tag field. The search matching field is used to accurately point to the data category in the target domain knowledge base, and the attribute tag field is used to identify whether the natural language query contains preset high-frequency words.

[0091] When the system receives a natural language query input from a user (e.g., "Can a physics student in Province A with a score of 450 apply for an artificial intelligence major?"), it inputs the query into the query rewriting node. The core of the query rewriting node is a large language model configured with a specific prompting project. This prompting project contains no fewer than 50 sets of uniformly formatted examples (each set includes a user query example and a corresponding JSON-formatted structured subquery example). Guided by the prompting project, the large language model decomposes the user's fuzzy query into intent, extracts elements, and converts it into a JSON-formatted structured subquery. This JSON format contains retrieval matching fields corresponding to different vector knowledge bases (e.g., query2024AdmissionStatistics, queryEnrollmentPlan, etc.), as well as attribute tagging fields indicating whether the query involves preset high-frequency words (e.g., query_is_A).

[0092] This embodiment uses JSON format to store structured subqueries. It achieves accurate retrieval and high-frequency word recognition by using the matching field and attribute tag field, respectively, and realizes efficient connection between subqueries and knowledge base, effectively improving the accuracy of high-frequency word recognition.

[0093] In one embodiment, selecting the corresponding processing path based on the high-frequency word judgment result and constructing the context based on the structured subquery includes:

[0094] When the high-frequency word judgment result indicates that the structured subquery contains preset high-frequency words, the high-frequency word adaptive processing path is selected to construct the context based on the structured subquery;

[0095] When the high-frequency word judgment result indicates that the structured subquery does not contain the preset high-frequency words, the conventional processing path is selected to construct the context based on the structured subquery.

[0096] The system parses the structured subqueries in JSON format output by the query rewrite node, focusing on identifying the values ​​of the attribute marker fields that identify high-frequency words. If the value is "yes", it indicates that the user query involves preset high-frequency words (such as "Province A"), and the workflow is guided to the high-frequency word adaptive processing path; if the value is "no", the workflow enters the regular processing path.

[0097] This embodiment dynamically selects the processing path based on the high-frequency word judgment results, realizes a differentiated retrieval strategy, and adopts special processing for high-frequency word queries, which greatly improves the robustness of the system.

[0098] In one embodiment, constructing a context based on a structured subquery through a high-frequency word adaptive processing path includes:

[0099] Hard-coded data is obtained by hard-coding the data corresponding to preset high-frequency words into the prompt words.

[0100] Parse the structured subqueries in JSON format and extract the search matching fields corresponding to each vector knowledge base;

[0101] Based on the extracted search matching fields, search requests are sent to various vector knowledge bases simultaneously and search results are obtained.

[0102] Hard-coded data is aggregated together with search results to form context.

[0103] In the high-frequency word adaptive processing path of this embodiment, the system hardcodes authoritative data (such as the province's enrollment policies, typical admission cases, etc.) corresponding to preset high-frequency words, which have been manually verified, into the prompt words. At the same time, based on the retrieval matching field in the structured subquery, it sends retrieval requests to the corresponding vector knowledge base in parallel to obtain retrieval results. Then, the hard-coded authoritative data and retrieval results are integrated, deduplicated, sorted by relevance, and aggregated into context to filter noise information, effectively reducing the error rate of high-frequency word queries and significantly improving factual consistency.

[0104] In one embodiment, constructing a context based on a structured subquery via a regular processing path includes:

[0105] Parse the structured subqueries in JSON format and extract the search matching fields corresponding to each vector knowledge base;

[0106] Based on the extracted search matching fields, search requests are sent to various vector knowledge bases simultaneously and search results are obtained.

[0107] Aggregate search results into context.

[0108] In this embodiment, the search results are directly retrieved from multiple vector knowledge bases in parallel based on the search fields of the structured subquery in the conventional processing path. The retrieved results are deduplicated, sorted and aggregated into context, which simplifies the processing flow, effectively improves the processing efficiency of non-high-frequency word queries and ensures the system response speed.

[0109] In one embodiment, generating a target answer based on context and a natural language query includes:

[0110] The context and natural language query are input into a pre-defined generative model, which outputs the target answer. The generative model is a large language model that has been fine-tuned with data from the target domain.

[0111] In this embodiment, the aggregated context and the user's original query (natural language query) are input into the final generative model. This generative model is a large language model that has been fine-tuned with question and answer data from the field of college admissions consultation. The generative model generates accurate, fluent, and user-intended target answers.

[0112] This embodiment uses a generative model fine-tuned with domain data to generate answers by combining context and the original query, effectively improving the professional relevance of the generated answers and ensuring that the language fluency of the generated target answers is close to or reaches the level of professional consultants.

[0113] To more clearly illustrate the implementation principle of this application, the domain-specific knowledge-enhanced question-answering task addressed by this application is defined as follows:

[0114] Given a natural language query Q input by a user, and a set K = {K_1, K_2, ..., K_n} consisting of multiple heterogeneous knowledge bases, where each K_i represents a specific type of knowledge base (such as question-answer pairs, score tables, etc.), the goal of this application is to generate an accurate, logically coherent, and highly relevant response A to the user's intent. This process can be formally represented as:

[0115] A=G(Q,C)

[0116] Here, G represents the final generative model, and C represents the context constructed to answer the query. The challenge of existing methods lies in how to efficiently construct C from K. This application optimizes the construction of C through a two-stage process:

[0117] Q'=R_w(Q)

[0118] C=R_a(Q',K)

[0119] Here, R_w represents the query rewriting function proposed in this application, which transforms the original query Q into a structured query object Q'. R_a represents the adaptive retrieval and aggregation function, which intelligently retrieves and combines information from K based on the content of Q', ultimately generating a high-quality context C.

[0120] To address the "semantic sparsity" problem in the original data and lay the foundation for subsequent collaborative retrieval, this application first performs offline semantic enhancement preprocessing on all knowledge base data.

[0121] For unstructured text data, such as college admissions Q&A, each data entry D_original is first input into an auxiliary large language model. This model, based on preset instructions, generates a set of keywords T={t_1,t_2,...,t_m} that summarizes the core content of D_original. The enhanced data entry D_enhanced is then constructed by concatenating the original text with this set of tags.

[0122] For structured tabular data, a text transformation is first performed. Each row in the table is converted into an independent text record, formatted as a concatenation of multiple "column name: cell value" pairs. Subsequently, for each transformed text record, the same semantic enhancement process as for unstructured data is applied, namely, using a large language model to generate and attach a set of keyword tags.

[0123] All semantically enhanced data is ultimately vectorized and stored in its own independent vector knowledge base Ki, based on its source and type.

[0124] The query rewriting and adaptive retrieval process is the core of the online processing stage of this application. It achieves deep collaboration between queries and data through sophisticated prompting engineering and solves the system's robustness problem through dynamic workflow.

[0125] The entry point of this process is a query rewriting node, the core of which is a large language model configured with specific prompt words. These prompt words force the model to perform two key tasks: 1) convert the user's natural language query Q into a JSON object Q' containing multiple predefined keys; 2) during the conversion, determine whether the query involves predefined high-frequency words (such as "Province A"), and mark them in the JSON object using specific key-value pairs. These predefined keys directly correspond to the various heterogeneous knowledge bases Ki that are constructed. The prompt words ensure that the large language model can stably and accurately generate JSON objects conforming to the predetermined structure by providing numerous highly standardized examples.

[0126] Example of output from querying the rewritten node:

[0127] <example>

[0128] <user_query>

[0129] Hello, could you please tell me what your school's admission score was this year? I'm a physics student from province A, and I scored 450 points. I'd like to apply for the Artificial Intelligence major.

[0130] < / user_query>

[0131] <expected_output>

[0132] {

[0133] "is_school_inquiry":"Yes",

[0134] "query_is_A":"Yes",

[0135] "query2024AdmissionStatistics":"<#school name#> 2024 Admission Statistics in Province A",

[0136] "queryEnrollmentPlan":"<#school name#> 2025 Enrollment Plan in Province A",

[0137] "queryExamScores": "450 points for Physics (Science) candidate in Province A, 2025 College Entrance Examination".

[0138] "querySchoolProfile":"<#school name#>Introduction to the Artificial Intelligence Major and its Programs"

[0139] }

[0140] < / expected_output>

[0141] < / example>

[0142] After obtaining the structured query object Q', the system enters the adaptive retrieval phase. The system first checks the value of the query_is_A field in Q'. If the value is "yes," the workflow is directed to a processing node specifically designed for the query "Province A." In the prompts at this node, data about Province A is directly hardcoded to avoid errors caused by inaccurate vector retrieval. If the value is "no," the workflow proceeds to the regular processing node.

[0143] Regardless of the processing path entered, the system utilizes other query fields in Q' (such as query2024AdmissionStatistics, queryEnrollmentPlan, etc.) to retrieve information in parallel from the corresponding vector knowledge base K_i. Subsequently, all recalled information fragments, along with the fixed data in the prompts (in the adaptive path), are aggregated to form the final context C. This context aggregation strategy ensures that for complex problems requiring the integration of multiple aspects of information, the generative model can obtain comprehensive and sufficient judgment criteria.

[0144] The following three typical examples of college admissions consultation scenarios illustrate the specific implementation process of this application in detail, covering different scenarios such as high-frequency word queries, regular queries, and complex multi-demand queries. The large language models used are GPT-4 (semantic enhancement and query rewriting) and ERNIE4.0 (response generation, fine-tuned with 5,000 admissions Q&A data), and the vector encoding model used is Sentence-BERT.

[0145] Example 1: High-frequency word query scenario (involving the high-frequency province of "B province")

[0146] Scenario description: The user inputs "I got 530 points in the history major in Province B. I want to apply for the Chinese Language and Literature major. Can I get into your school?" ("Province B" is a preset high-frequency word with an 8% word frequency in the domain knowledge base)

[0147] Step 1: Semantic enhancement preprocessing

[0148] Unstructured data: The original text "The minimum admission score for the Chinese Language and Literature major in Province B for the history major in a certain university in 2024 is 542 points, and the maximum score is 568 points". After generating keywords "2024-Chinese Language and Literature-Province B-history-542-568" by GPT-4, it is spliced into enhanced data: "The minimum admission score for the Chinese Language and Literature major in Province B for the history major in a certain university in 2024 is 542 points, and the maximum score is 568 points [2024-Chinese Language and Literature-Province B-history-542-568]", and stored in the knowledge base of past admission situations.

[0149] Structured data: The line "Score: 530; Cumulative number of people: 28000; Ranking: 27501-28000" in the one-point-one-section table of Province B for the history major in 2025 is converted according to the template into "Score: 530; Cumulative number of people: 28000; Ranking: 27501-28000". After generating the keyword "2025-Province B-history-530-ranking 28000" and splicing, it is stored in the knowledge base of the college entrance examination one-point-one-section table.

[0150] Step 2: Vector knowledge base construction

[0151] The above enhanced data is vectorized by Sentence-BERT and stored in the knowledge base of past admission situations and the knowledge base of the college entrance examination one-point-one-section table respectively; at the same time, the enhanced data of "A certain university plans to recruit 25 students for the Chinese Language and Literature major in Province B in 2025" is stored in the knowledge base of the current year's enrollment plan.

[0152] Step 3: Query rewriting

[0153] Prompt engineering guides GPT-4 to output a JSON structured sub-query:

[0154] {

[0155] "is_school_inquiry": "yes",

[0156] "query_is_B": "yes", / / High-frequency word judgment field

[0157] "query2024Admission": "Admission data for the Chinese Language and Literature major in Province B for the history major in a certain university in 2024",

[0158] "query2025Plan": "Enrollment plan for the Chinese Language and Literature major in Province B for a certain university in 2025"

[0159] "queryScoreRank": "The rank corresponding to 530 points in the history category of Province B in 2025"

[0160] }

[0161] Step 4: Dynamic Path Selection

[0162] Parse "query_is_B = yes", enter the high-frequency word adaptive processing path, and hard-code authoritative data: "The undergraduate line for the history category in Province B in 2025 is 490 points."

[0163] Step 5: Parallel Retrieval and Context Aggregation

[0164] Parallelly retrieve the three knowledge bases of the admission situation knowledge base over the years, the college entrance examination score segment table knowledge base, and the current year's enrollment plan knowledge base based on the structured sub-query, and obtain:

[0165] Admission database over the years: "The lowest score in 2024 was 542 points."

[0166] Enrollment plan database: "The planned enrollment in 2025 is 25 people."

[0167] Score segment database: "The rank corresponding to 530 points is 28,000."

[0168] Aggregate context: "The undergraduate line for the history category in Province B in 2025 is 490 points; the lowest admission score for the Chinese Language and Literature major in the history category of Province B at a certain university in 2024 was 542 points; the planned enrollment for this major in 2025 is 25 people; the rank corresponding to 530 points in the history category of Province B in 2025 is 28,000."

[0169] Step 6: Answer Generation

[0170] ERNIE 4.0 output: "Hello! The undergraduate line for the history category in Province B in 2025 is 490 points, and your 530 points reach the undergraduate line; the lowest admission score for the Chinese Language and Literature major at a certain university in 2024 in the history category of Province B was 542 points, and your score is lower than this score line; the planned enrollment for this major in Province B in 2025 is 25 people, the same as last year. Considering the rank corresponding to 530 points, which is 28,000 in the province and the previous year's admission rank (the lowest admission rank in 2024 was 25,000), the possibility of being admitted to this major is relatively low. It is recommended to consider our school's Chinese International Education major (the lowest score in 2024 was 525 points)."

[0171] Example 2: Conventional Query Scenario (without High-frequency Words)

[0172] Scenario description: The user inputs "How many years is the school system for the clinical medicine major? What are the core courses?" (without high-frequency provinces / majors, enter the conventional path)

[0173] Steps 1-2: Data Preprocessing and Knowledge Base Construction

[0174] The unstructured text "Clinical Medicine major has a 5-year program, and core courses include human anatomy, pathology, internal medicine, and surgery" is enhanced by generating the keywords "Clinical Medicine - 5-year program - core courses" and then stored in the admissions Q&A knowledge base.

[0175] Step 3: Query Rewrite

[0176] Output JSON subquery:

[0177] {

[0178] "is_school_inquiry":"Yes",

[0179] "query_is_highfreq":"No", / / Non-high-frequency query

[0180] "queryMajorInfo": "Length of study and core courses of a clinical medicine major at a certain university"

[0181] }

[0182] Step 4: Dynamic Path Selection

[0183] Parse "query_is_highfreq=no" and proceed to the normal processing path.

[0184] Steps 5-6: Retrieval and Generation

[0185] The system retrieves enhanced data from the admissions Q&A knowledge base and generates an answer after aggregating the context: "The clinical medicine program at our school is a 5-year program. Core courses include human anatomy, histology and embryology, physiology, pathology, pharmacology, internal medicine, surgery, obstetrics and gynecology, and pediatrics, which cultivate medical talents with clinical diagnosis and research capabilities."

[0186] Example 3: Complex multi-demand query scenario (involving multi-knowledge base collaboration)

[0187] Scenario Description: A user inputs, "I scored 620 in science in Province C and want to apply for Computer Science and Technology. What was my admission ranking last year? How many students will be admitted this year? What is the tuition fee?" (This involves 3 different knowledge base requirements)

[0188] Step 3: Query Rewrite

[0189] Output JSON subquery:

[0190] {

[0191] "is_school_inquiry":"Yes",

[0192] "query_is_C": "Yes", / / Province C is a high-frequency word (word frequency 6%)

[0193] "query2024Rank": "The admission rank of the computer science major for science students in Province C of a certain university in 2024",

[0194] "query2025Plan": "The enrollment number of the computer science major in Province C of a certain university in 2025",

[0195] "queryTuition": "The tuition standard of the computer science major in a certain university"

[0196] }

[0197] Step 4 - 5: Dynamic Retrieval and Aggregation

[0198] Hard code "The science undergraduate line in Province C in 2025 is 513 points";

[0199] Parallelly retrieve the annual admission database (the admission rank in 2024 is 8,000), the enrollment plan database (40 students will be enrolled in 2025), and the enrollment Q&A database (tuition is 5,200 yuan / year);

[0200] Aggregate the context to include all the above information.

[0201] Step 6: Answer Generation

[0202] Output an answer that integrates multi-dimensional information, clearly respond to the questions about rank, enrollment number, and tuition, and give application suggestions. The generated answer can be as follows:

[0203] "Hello! Combining your score, intended major, and the authoritative information retrieved, the relevant questions are explained as follows:

[0204] First, regarding the admission rank and enrollment plan: The admission rank of our school's computer science and technology major for science students in Province C in 2024 was 8,000; the enrollment plan for this major in Province C in 2025 is 40 students, with 5 more places than last year, and the admission opportunity has increased slightly.

[0205] Second, regarding the tuition standard: The tuition for our school's computer science and technology major is 5,200 yuan per student per academic year, and the charging standard complies with the relevant regulations on education fees in Province C. In addition, other fees such as accommodation fees need to be paid according to the unified school standards (subject to the admission notice for details).

[0206] Based on the application advice: In 2025, the minimum admission score for science majors in Province C was 513. Your score of 620 far exceeds the undergraduate admission line, giving you a strong competitive advantage. However, please note that computer science is a popular engineering major, and competition is always fierce. We suggest you pay close attention to your provincial ranking after your college entrance examination score is released: If your ranking is around 8000 or higher, your chances of success are high; if your ranking is slightly lower than 8000, you can consider applying to related computer science majors such as Big Data Technology and Artificial Intelligence at our university. These majors are highly related to the Computer Science and Technology curriculum, and their admission rankings have been relatively moderate in the past two years, allowing for a reasonable gradient in your application choices.

[0207] Furthermore, computer science demands strong logical thinking and continuous learning abilities. If you are interested in areas such as technology research and development and algorithm design, you can participate in the school's artificial intelligence laboratory projects after enrollment. Leveraging the disciplinary platform, you can enhance your practical skills and lay a foundation for future further studies or employment.

[0208] The embodiments described above propose a retrieval enhancement generation method that deeply co-designs data processing and suggestion engineering. This method generates structured subqueries that highly match the semantically enhanced data representation format by rewriting suggestion engineering through queries, effectively solving the "semantic misalignment" problem between query intent and data representation, and significantly improving retrieval accuracy. A dynamic adaptive workflow based on query content recognition is designed. This mechanism can proactively identify and isolate high-frequency word queries that may cause retrieval bias. By switching to specific nodes that process high-frequency words, it alleviates the system robustness problem caused by uneven data distribution. A complete solution supporting parallel retrieval and contextual aggregation is constructed. This solution can simultaneously acquire and effectively integrate information from multiple different types of data sources for a single complex problem, enabling large language models to perform complex reasoning tasks requiring multi-information-source support, greatly expanding the application potential and response depth of RAG systems.

[0209] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0210] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0211] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0212] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A retrieval enhancement generation method integrating dynamic adaptive suggestion engineering and semantic enhancement, characterized in that, Includes the following steps: Offline semantic enhancement preprocessing is performed on the raw data in the target domain knowledge base; The data that has undergone semantic enhancement preprocessing is vectorized offline, and a corresponding vector knowledge base is built according to the data type and purpose. The vectorized data is then stored in the corresponding vector knowledge base. When a natural language query is received from a user, the natural language query is converted into a structured subquery through a preset query rewriting node. The natural language query is an unstructured query in a specific scenario of the target domain. Determine whether the structured subquery contains preset high-frequency words, and obtain the high-frequency word determination result; Based on the high-frequency word judgment results, the corresponding processing path is selected, and a context is constructed based on the structured subquery according to the selected processing path; Generate the target answer based on the context and the natural language query; in, The step of selecting the corresponding processing path based on the high-frequency word judgment result, and constructing a context based on the structured subquery according to the selected processing path, includes: When the high-frequency word judgment result indicates that the structured subquery contains preset high-frequency words, the high-frequency word adaptive processing path is selected to construct a context based on the structured subquery, specifically including: Hard-coded data is obtained by hard-coding the data corresponding to preset high-frequency words into the prompt words. Parse the structured subquery and extract the retrieval matching fields corresponding to each vector knowledge base; Based on the extracted search matching fields, search requests are sent to each vector knowledge base simultaneously and search results are obtained. The hard-coded data and the search results are aggregated together to form a context. When the high-frequency word judgment result indicates that the structured subquery does not contain the preset high-frequency words, a conventional processing path is selected to construct a context based on the structured subquery, specifically including: Parse the structured subquery and extract the retrieval matching fields corresponding to each vector knowledge base; Based on the extracted search matching fields, search requests are sent to each vector knowledge base simultaneously and search results are obtained. The search results are aggregated into context.

2. The retrieval enhancement generation method integrating dynamic adaptive prompting engineering and semantic enhancement according to claim 1, characterized in that, The semantic enhancement preprocessing includes: For unstructured text data, a large language model is used to generate keywords based on the text data, and the keywords are concatenated with the original text to form enhanced data; For structured tabular data, each row of data in the table is first converted into an independent text line according to a preset text conversion template. Then, keywords are generated for each text line using a large language model, and the keywords are concatenated with the corresponding text lines to form enhanced data.

3. The retrieval enhancement generation method integrating dynamic adaptive prompting engineering and semantic enhancement according to claim 2, characterized in that, The preset text conversion template is a key-value pair format consisting of column name and cell value.

4. The retrieval enhancement generation method integrating dynamic adaptive prompting engineering and semantic enhancement according to claim 1, characterized in that, The step of converting the natural language query into a structured subquery through a preset query rewriting node includes: Obtain the natural language query input by the user; The natural language query is input into a large language model configured with a preset suggestion project, wherein the preset suggestion project is a dedicated suggestion strategy designed for a specific scenario in the target domain; The preset prompting process guides the large language model to deconstruct the intent, extract elements, and reconstruct the format of the natural language query, outputting a structured subquery that is adapted to the data representation of the target domain knowledge base.

5. The retrieval enhancement generation method integrating dynamic adaptive prompting engineering and semantic enhancement according to claim 4, characterized in that, The preset prompt project includes a format constraint module, an example training module, and an intent guidance module, wherein... The format constraint module is used to limit the output format and field naming rules of structured subqueries; The example training module is used to provide labeled natural language query-structured subquery sample pairs; The intent guidance module is used to instruct the large language model to identify the core requirements in natural language queries.

6. The retrieval enhancement generation method integrating dynamic adaptive prompting engineering and semantic enhancement according to claim 5, characterized in that, The output format of the structured subquery is JSON format. The JSON format structured subquery includes a search matching field and an attribute tag field. The search matching field is used to accurately point to the data category in the target domain knowledge base, and the attribute tag field is used to identify whether the natural language query contains preset high-frequency words.

7. The retrieval enhancement generation method integrating dynamic adaptive prompting engineering and semantic enhancement according to any one of claims 1-6, characterized in that, The generation of the target answer based on the context and the natural language query includes: The context and the natural language query are input into a preset generative model, and the target answer is output. The generative model is a large language model that has been fine-tuned with target domain data.

Citation Information

Patent Citations

  • Prompt word generation method and device, equipment, medium and program product

    CN118296119A

  • Model acceleration database retrieval optimization system and method based on knowledge graph

    CN119046315A