Structured data query intent alignment system based on persistent user semantic memory

CN122964104APending Publication Date: 2026-10-23HUAZHONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611450372.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-18
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

其主要缺点包括:1)缺乏跨会话的持久记忆,导致意图被重复澄清

Benefits of technology

通过设立用于记录用户语义表达偏好的用户表达画像库和用于追踪用户对数据库字段认知状态的用户数据库认知画像库,并在每次完整交互结束后提炼可泛化的语义知识对二者进行更新,从而实现对用户的语言习惯进行持久性记忆,以及对用户的数据库认知状态进行动态建模,进而对新用户进行有效的知识引导,对已熟悉数据库的用户避免冗余解释,最终实现随使用时间的增长不断降低沟通成本、提升查询效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122964104A_ABST
    Figure CN122964104A_ABST
Patent Text Reader

Abstract

The application discloses a structured data query intention alignment system based on continuous user semantic memory, which comprises three horizontal levels and an asynchronous learning layer in parallel; a user interaction layer is used for bearing natural language input of a user and result output of the system; a core processing layer is used for receiving natural language input of the user, performing semantic understanding, ambiguity resolution and intention confirmation, and finally generating and executing a structured query statement; a data storage layer is used for managing a user expression portrait library for recording semantic expression preferences of the user, a user database cognition portrait library for tracking cognition states of the user to database fields, and a business database for storing actual business data; the asynchronous learning layer runs in parallel with the core processing layer, and is used for extracting generalizable semantic knowledge from records of a complete interaction and writing the generalizable semantic knowledge into a user knowledge document library after the complete interaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of Natural Language Database Query (NL2SQL), specifically relating to a structured data query intent alignment system based on continuous user semantic memory. Background Technology

[0002] Currently, natural language database query systems can generally be categorized into two types: in-conversation clarification query enhancement systems and personalized query enhancement systems based on RAG example memory. Both types of solutions attempt to reduce the query failure rate caused by users' ambiguous expressions, but they have significant shortcomings in persistent modeling at the cognitive level.

[0003] Specifically, in-session clarification query enhancement systems are typically represented by ThoughtSpot, Tableau Ask Data, and most large model-driven conversational data query components. When the system detects semantically ambiguous or unresolvable components in a user's query, it generates follow-up questions within the current conversation, requiring the user to select fields, confirm definitions, or provide filtering conditions. The system utilizes the context of the current conversation to resolve ambiguities and generates the corresponding query after receiving a clear answer. Some products also alleviate ambiguity in business terms through predefined thesaurus or "aliases" in the data model, enabling the system to confirm intent within a single conversation. The entire interaction lifecycle is strictly confined to the same browser session or conversation window; once the session is closed, all intermediate understanding states are discarded. Its main drawbacks include: 1) lack of persistent memory across sessions, leading to repeated clarification of intent; 2) clarification methods are mostly linear, single-threaded follow-up questions; 3) lack of modeling of the user's cognitive state in the database, resulting in a "one-size-fits-all" interpretation strategy.

[0004] Personalized query enhancement systems based on RAG example memory, exemplified by VannaAI and some companies' self-built Text-to-SQL memory libraries, store historical query pairs ("natural language question - SQL statement") or a small number of annotated semantic mappings in a vector database. When a new query is received, the most relevant past examples are retrieved and injected into the large model as a few-sample hint to improve the accuracy and terminology coverage of SQL generation. Some systems also allow users to "like" examples or directly upload corrected SQL to update the retrieval database, thus giving the system a certain degree of "learning" ability. Its main drawbacks include: 1) The memorized content is limited to query templates, lacking deep abstraction of business semantics and user cognitive state. 2) Purely relying on SQL examples cannot eliminate users' incorrect assumptions about the database. 3) The update mechanism is unidirectional and coarse-grained, lacking symmetrical learning and cognitive guidance design. Summary of the Invention

[0005] To address the aforementioned deficiencies or improvement needs of existing technologies, this invention proposes a structured data query intent alignment system based on continuous user semantic memory, which can continuously reduce communication costs and improve query efficiency as usage time increases.

[0006] To achieve the above objectives, according to one aspect of the present invention, a structured data query intent alignment system based on continuous user semantic memory is provided, comprising three horizontal levels and a parallel asynchronous learning layer; wherein, The system has three horizontal layers: a user interaction layer, a core processing layer, and a data storage layer. The user interaction layer handles the user's natural language input and the system's output. The core processing layer receives the user's natural language input, performs semantic understanding, ambiguity resolution, and intent confirmation, and finally generates and executes structured query statements, delivering the results to the user interaction layer. The data storage layer manages the user knowledge document library on which the system operates and the business database for storing actual business data. The user knowledge document library includes a user expression profile library for recording user semantic expression preferences and a user database cognitive profile library for tracking user cognitive status of database fields. The asynchronous learning layer runs in parallel with the core processing layer. After each complete interaction, it extracts generalizable semantic knowledge from the record of the complete interaction and writes it into the user knowledge document library.

[0007] According to the above scheme, the user knowledge document base consists of several discrete semantic memory entries; The core processing layer includes: The context assembly module is used to generate vector representations of the user's natural language, perform semantic retrieval in the user's knowledge document library, obtain a set of relevant semantic memory entries, and assemble them together with the database schema into a context. The semantic diagnosis module is used to inject the assembled context into the large language model, execute a synchronous inference call, obtain structured diagnosis results, and determine whether additional information is needed. The Clarification and Database Probing module is triggered when the semantic diagnosis determines that supplementary information is needed. It is used to generate and execute a probing query against the business database based on the items to be explored in the structured diagnosis results. The query results and structured diagnosis results are merged to generate a composite clarification request, which is presented to the user. After the user responds, the user's reply is incorporated into the semantic state of the current session, and the semantic diagnosis is returned to execute another synchronous reasoning call. The intent confirmation and text-to-query module is used to generate and execute SQL based on the standardized query intent in the confirmed structured diagnostic results when no additional information is needed, or after the user responds to a compound clarification request and completes intent confirmation, and return the query results to the user; at the same time, the complete interaction record is passed to the asynchronous learning layer.

[0008] According to the above scheme, the semantic retrieval is a cosine similarity retrieval, and the set of relevant semantic memory entries obtained is the k most relevant to the current query semantics; k is a preset fixed value used to control the number of context tokens consumed by reasoning.

[0009] According to the above scheme, each semantic memory entry is represented by natural language text, and is accompanied by a high-dimensional vector representation generated by a text embedding model to support semantic retrieval. The number of entries in the user knowledge document grows dynamically with each complete interaction and is persistently stored using a vector database.

[0010] According to the above scheme, each semantic memory entry is accompanied by the following metadata: Historical activation frequency represents the cumulative number of times that semantic memory entry has been retrieved and actually used in reasoning; Recent activation timestamp; Source credibility markers indicate whether the information was explicitly confirmed by the user or inferred by the system but has not yet been confirmed by the user. Specifically, based on the aforementioned metadata, a time decay weight is applied to the semantic memory entry during the retrieval ranking, thereby reducing its retrieval priority.

[0011] According to the above scheme, the asynchronous learning layer is also used to write the resolved ambiguities into a user expression profile library for recording user semantic expression preferences when the user confirms the intent summary.

[0012] According to the above scheme, the user expression profile library is used to store the mapping knowledge from non-standard business expressions specific to a particular user, which is summarized from historical interactions, to standard database terms; The aforementioned non-standard business expressions refer to personalized abbreviations, internal jargon, and business idioms with specific meanings that cannot be parsed by general string matching or public dictionaries.

[0013] According to the above scheme, the user database cognitive profile library is used to store descriptive knowledge about a specific user's cognitive state of the database logical structure and data characteristics, which is summarized from historical interactions. This includes the rules that the user has mastered, the erroneous assumptions that have occurred, and the cognitive blind spots that still exist. Past erroneous assumptions serve as early warning clues for future queries, while existing cognitive blind spots serve as directions for proactive system guidance. The user database cognitive profile library has a cognitive state field, which is used to mark the rules that have been mastered, the erroneous assumptions that have occurred, and the current cognitive blind spots. The cognitive state field constitutes a dynamically evolving user database knowledge graph, and the quantitative improvement of the user database cognitive level is judged by the state transition marked in the cognitive state field.

[0014] According to another aspect of the present invention, a query method is provided that utilizes the aforementioned structured data query intent alignment system based on persistent user semantic memory, comprising the following steps: Receives natural language input from the user; Natural language is generated into vector representations, semantic retrieval is performed in the user's knowledge document library to obtain a set of relevant semantic memory entries, and these are assembled into a context together with the database schema. The assembled context is injected into the large language model, a synchronous inference call is executed, the structured diagnostic results are obtained, and it is determined whether additional information is needed. If additional information is needed, an exploration query for the business database is generated and executed based on the items to be explored in the structured diagnostic results. The query results and structured diagnostic results are then merged to generate a composite clarification request, which is presented to the user. After the user responds, the user's response is incorporated into the semantic state of the current session, and the semantic diagnostic is returned to execute another synchronous inference call. When no additional information is required, or after the user responds to a compound clarification request and completes intent confirmation, SQL is generated and executed based on the standardized query intent in the confirmed structured diagnostic results, and the query results are returned to the user. After each complete interaction, generalizable semantic knowledge is extracted from the record of this complete interaction and written into the user knowledge document library.

[0015] Using the method described above, when a user confirms the intent summary, the resolved ambiguities are written into a user expression profile database used to record the user's semantic expression preferences.

[0016] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects: By establishing a user expression profile database to record users' semantic expression preferences and a user database cognitive profile database to track users' cognitive state of database fields, and by refining generalizable semantic knowledge and updating both databases after each complete interaction, we can achieve persistent memory of users' language habits and dynamic modeling of users' database cognitive state. This enables effective knowledge guidance for new users and avoids redundant explanations for users who are already familiar with the database. Ultimately, this will continuously reduce communication costs and improve query efficiency as usage time increases. Attached Figure Description

[0017] Figure 1 This is a system architecture diagram provided in an embodiment of the present invention.

[0018] Figure 2 This is a comparison diagram of context injection in the semantic diagnosis module provided in this embodiment of the invention.

[0019] Figure 3 This is a schematic diagram of context injection for the semantic diagnosis module provided in an embodiment of the present invention.

[0020] Figure 4 This is a flowchart of a method provided in an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.

[0022] 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 at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0023] This invention aims to provide a user query intent alignment system for structured data query scenarios. Its core objective is to enable business users who do not have the ability to use structured query language to accurately and efficiently obtain business data from the database in a natural language manner. At the same time, the system can gradually accumulate semantic understanding of specific users through continuous interaction, thereby continuously reducing communication costs and improving query efficiency as usage time increases.

[0024] This solution is based on two symmetrical propositions: "Making the system increasingly understand the user" and "Making the user increasingly understand the database." These two propositions are not independent and parallel optimization goals, but rather two cognitive products of the same human-computer interaction: 1) In the process of the system resolving the user's semantic ambiguity, the user simultaneously acquires database knowledge; 2) In the process of the user confirming the system's understanding, the system simultaneously acquires the user's personalized expression patterns. The technical design of this solution serves to enable this symmetrical learning process to continuously accumulate, be maintained across sessions, and automatically evolve with the increase in the number of interactions.

[0025] To achieve the above objectives, according to one aspect of the present invention, this embodiment provides a structured data query intent alignment system based on continuous user semantic memory, such as... Figure 1 As shown, it includes three horizontal layers and a parallel asynchronous learning layer.

[0026] The system comprises three horizontal layers: a user interaction layer, a core processing layer, and a data storage layer. The user interaction layer handles the user's natural language input and the system's output. The core processing layer receives the user's natural language input, performs semantic understanding, ambiguity resolution, and intent confirmation, and ultimately generates and executes structured query statements, delivering the results to the user interaction layer. The data storage layer manages the user knowledge document library upon which the system operates and the business database for storing actual business data. The user knowledge document library includes a user expression profile library for recording user semantic expression preferences and a user database cognitive profile library for tracking user cognitive status regarding database fields.

[0027] The core processing layer consists of four functional modules executed sequentially in a fixed order: context assembly module, semantic diagnosis module, clarification and database exploration module (conditionally triggered), and intent confirmation and text-to-query statement module. The semantic diagnosis module has a conditional decision node after completing the diagnosis: if the current query is semantically complete and requires no additional information, the system skips the clarification and database exploration module and directly proceeds to the intent confirmation and text-to-query statement module; otherwise, the clarification and database exploration module is triggered to collect necessary supplementary information before proceeding. The core intent of this design is to transform the invocation of the large language model from "occurring with every interaction" to "dynamically determined according to actual needs," thereby avoiding unnecessary delays and resource consumption.

[0028] The asynchronous learning layer runs in parallel with the core processing layer. After each complete interaction, it extracts generalizable semantic knowledge from the record of that interaction and writes it into the user knowledge document library. This learning process is executed asynchronously in the background and does not block the main process from responding to the current user's request. As the number of interactions accumulates, the system's semantic understanding ability for a specific user will continuously improve. Specifically, the number of clarification requests for the same semantic ambiguity tends to decrease, and the system's automatic recognition rate of user's habitual expressions tends to increase.

[0029] The user knowledge document is the core data structure of this solution. Essentially, it's a persistent semantic memory for a single user, belonging to the external long-term memory component of the LLM Agent architecture. Unlike structured data tables or hard-coded mapping dictionaries, the user knowledge document consists of several discrete semantic memory entries. Each entry is represented by natural language text, accompanied by a high-dimensional vector representation generated by a text embedding model to support semantic approximate retrieval. The user knowledge document does not have a fixed upper limit on the number of entries; it is persistently stored in a vector database and dynamically grows with each valid interaction.

[0030] Specifically, the user knowledge document library includes a user expression profile library for recording users' semantic expression preferences and a user database cognitive profile library for tracking users' cognitive status of database fields.

[0031] The User Expression Profile (EPM) database is primarily used to store the mapping knowledge from historical interactions, which is specific to a particular user, to standard database terminology. Here, "non-standard" specifically refers to personalized abbreviations, internal jargon, and business idioms with specific meanings that cannot be resolved through general string matching or public dictionaries; that is, expressions whose semantics may be ambiguous for different users or systems within the same organization. Taking a data analysis scenario of a retail group as an example, typical memory entries in the User Expression Profile database are shown in Table 1.

[0032] Table 1

[0033] The User Database Cognitive Profile (DCPM) primarily stores descriptive knowledge about a user's cognitive state regarding the database's logical structure and data characteristics, gleaned from historical interactions. This includes rules already mastered by the user (requiring no further explanation), previously made erroneous assumptions (serving as early warning clues for future queries), and currently existing cognitive blind spots (directions the system should actively guide). Table 2 shows typical memory entries in the User Database Cognitive Profile for the same scenario.

[0034] Table 2

[0035] The cognitive state field of the user database cognitive profile library itself constitutes a dynamically evolving user database knowledge graph, and its state transition from "confused to known" is a quantitative manifestation of the improvement of the user database's cognitive level.

[0036] The core processing layer includes a context assembly module, a semantic diagnosis module, a clarification and database exploration module, and an intent confirmation and text-to-query statement module.

[0037] The context assembly module is used to generate vector representations of the user's natural language, perform semantic retrieval in the user's knowledge document library, obtain a set of relevant semantic memory entries, and assemble them together with the database schema into a context.

[0038] Each semantic memory entry, upon being written, has its natural language description text generated by the LLM and its corresponding vector representation generated by the embedding model. Let the user... User knowledge documents are stored in the CCP The semantic memory entry, the first The vector representation of each entry is as follows When a user submits a natural language query At that time, the system generates a vector representation of the query. It also uses cosine similarity to retrieve the semantically most relevant match to the current query. 1 memory entry:

[0039] In the formula, Let S be the set of related semantic memory entries, and S be the set of indices. The number of elements selected is The candidate index set.

[0040] The top-retrieved Related memories and the database schema together constitute the context injection content for LLM inference. This mechanism ensures that even as the user's knowledge document continues to grow over time and the total number of entries increases... There is no upper limit, and the number of context tokens consumed in each inference remains stable within the parameters. Within the scope of control, a balance is struck between scalability and accuracy.

[0041] Each semantic memory entry is accompanied by the following metadata: historical activation frequency, indicating the cumulative number of times the semantic memory entry has been retrieved and actually used in reasoning; recent activation timestamp; source credibility marker, indicating whether it was explicitly confirmed by the user or inferred by the system but has not yet been confirmed by the user.

[0042] For inferred entries that have not been activated for a long time and have never been explicitly confirmed by the user, a time decay weight can be applied to their retrieval ranking to reduce their retrieval priority, but they will not be physically deleted, so as to preserve their coverage of low-frequency edge scenarios. This mechanism is a natural forgetting mechanism for user knowledge documents and does not require any manually maintained clearing rules.

[0043] The semantic diagnostic module is used to inject the assembled context into the large language model, execute a synchronous inference call, obtain structured diagnostic results, and determine whether supplementary information is needed.

[0044] The semantic diagnostic module replaces rule-driven passive detection with predictive semantic diagnostics. Its core idea is: before the LLM begins analyzing user queries, it first performs top-level semantic diagnostics retrieved from user knowledge documents. The LLM injects relevant semantic memory entries into its system prompts, ensuring that the LLM carries the user's complete knowledge state when performing diagnostics. The LLM no longer functions as a stateless semantic analyzer, but rather as a personalized diagnostic engine holding a user profile. It can proactively distinguish between "this ambiguity has a historical solution" and "this ambiguity needs to be clarified again" during the diagnostic phase, thereby fundamentally eliminating the occurrence of redundant clarifications.

[0045] The diagnostic results of LLM are output in a structured format, containing four semantic partitions, as shown in Table 3.

[0046] Table 3

[0047] When the last three partitions are all empty, the system determines that the current query has been fully understood and directly enters the intent confirmation stage without any clarification interaction. This is a direct manifestation of the incremental value that predictive diagnostics brings to the user experience, such as... Figure 2 As shown.

[0048] Taking the processing of internal business terminology as an example, the behavioral differences between the two mechanisms are explained in detail. When a user first uses the system, they submit a query for "last week's overall GMV and self-operated percentage." The system cannot recognize the database mapping between "overall" and "self-operated," triggering a clarification interaction where the user provides explanations. After the initial interaction, two mapping entries are written to the EPM: "overall" → channel='ALL' and "self-operated" → biz_type='SELF'. When the user submits "this month's self-operated GMV month-on-month" a second time, the system searches the user's knowledge document during the context assembly phase, matching the two user expression profile entries mentioned above, and injects them into the system prompt. The LLM, during the diagnostic phase, reads the known mapping for "self-operated," marks it in the resolved_by_memory partition, and no longer generates any clarification requests. The user's perceived change is that the system, without any manual configuration, has "recognized" their familiar business expression style.

[0049] The clarification and database exploration module is triggered when the semantic diagnosis determines that additional information is needed. It is used to generate and execute exploration queries against the business database based on the items to be explored in the structured diagnosis results, merge the query results and structured diagnosis results to generate a composite clarification request, and present it to the user. After the user responds, the user's reply is incorporated into the semantic state of the current session, and the semantic diagnosis is returned to execute another synchronous inference call.

[0050] When multiple unresolved items exist in the diagnostic results, traditional systems typically employ a sequential questioning strategy, posing questions to the user one by one, waiting for a response from the user at each round before moving on to the next. When the number of concurrent ambiguities exceeds two, this approach incurs significant interaction costs, and the intermediate process is completely opaque to the user, easily causing confusion and fatigue. The design principle of this solution is single-round composite clarification: After completing the diagnosis, the LLM integrates all unresolved items into a single interaction request, completing all information collection in a single round of dialogue. This integration process itself is a semantic reasoning exercise; the LLM needs to determine which questions can be merged into structured options, which require triggering database probing to assist user decision-making, and which can be omitted and explicitly stated through reasonable business assumptions.

[0051] When the db_exploration_items partition of the diagnostic results is not empty, the system performs a targeted probing query and presents the results in a readable format in the clarification request. This step is designed not only to help users complete the current selection, but also to proactively convey the characteristics of the database content to users, thus fulfilling a cognitive and educational function.

[0052] Taking a specific scenario as an example: When a user queries "redemption rates for each channel in the third quarter," if the LLM diagnostics finds two semantically similar fields in the database, such as `coupon_redemption_cnt_rate` (based on coupon redemption count) and `coupon_redemption_amt_rate` (based on coupon amount), the system should not only present the names and definitions of these two fields to the user but also display their numerical distribution on recent representative data, enabling the user to make a selection based on intuitive data perception. After confirming the required calculation method, the user not only completes the disambiguation of the query but also learns the database knowledge that "redemption rates in this database have two calculation methods: by count and by amount." This knowledge is then written into the "known" partition of the user's database cognitive profile.

[0053] To ensure the usability of composite clarification requests, the following structural constraints are imposed on the LLM output, implemented through formatting instructions in the system prompts: Each clarification item must be guided by structured options or data presentations, and must not be presented in the form of open-ended questions and answers; when data exploration is involved, the data should be presented first, followed by questions, and the order should not be reversed; the total number of questions in a single clarification request shall not exceed 3, and any excess shall be handled by the LLM itself through clearly marked business default assumptions, and the user shall be informed of the assumptions used in the request to preserve the user's right to know and the opportunity for correction.

[0054] The intent confirmation and text-to-query module is used to generate and execute SQL based on the standardized query intent in the confirmed structured diagnostic results when no additional information is needed, or after the user responds to a compound clarification request and completes intent confirmation, and return the query results to the user; at the same time, the complete interaction record is passed to the asynchronous learning layer.

[0055] In addition to extracting generalizable semantic knowledge from the records of each complete interaction and writing it into the user knowledge document library after each complete interaction, the asynchronous learning layer is also used to write the resolved ambiguities into the user expression profile library for recording the user's semantic expression preferences when the user confirms the intent summary.

[0056] In some embodiments, updates to the user knowledge document are triggered under the following two conditions, both occurring asynchronously after the query execution phase of the main process and without blocking the return of user query results. First, explicit user confirmation triggers: The user gives positive confirmation to the intent summary presented by the system. This type of trigger has the highest confidence level for updating content and is suitable for writing resolved ambiguities into the EPM and for writing database rule knowledge that emerges during the clarification process into the user's database cognitive profile. Second, clarification interaction completion triggers: The user makes a clear selection of options during the clarification phase or confirms after the data exploration is displayed. This type of trigger is suitable for writing the database knowledge gained by the user during this data exploration into the "known" partition of the user's database cognitive profile, while simultaneously clearing or downgrading previously recorded related "confused" or "blind spot" entries.

[0057] The update of the user knowledge document is not a direct storage of the original dialogue record, but rather an extraction of generalizable semantic knowledge from the complete interaction record by a separate LLM inference call. Specifically, the LLM inference call receives the complete record of the interaction and is required to output several new semantic memory entries. Each entry must meet the following generalization criterion: the described knowledge has reusability value in future similar queries, that is, it describes stable rules, mappings, or user cognitive states, rather than one-off facts specific to this query.

[0058] To illustrate the difference, consider a specific interaction: The user confirms that "redemption rate" refers to the field `coupon_redemption_rate`. The EPM entry the system should generate should be "When this user mentions redemption rate, they are referring to `coupon_redemption_rate` (by amount)," not "This user queried the Q3 redemption rate on 2024-03-20." The latter is a one-time fact and has no reuse value in the user intent clarification process for future queries; therefore, it should not be included in the user's knowledge document.

[0059] use and They represent the first The user generates two sets of new memory entries in each direction after the interaction. User knowledge documents in the first The state after this interaction can be represented as:

[0060] The updates in both directions serve a perfectly symmetrical learning objective: the increase in EPM directly reduces the probability of the system triggering clarification requests in future similar queries, reflecting that "the system is becoming increasingly knowledgeable about users"; the increase in "known" status entries in the user database's cognitive profile library enables the system to omit repetitive explanations for experienced users and adjust response strategies, reflecting that "users are becoming increasingly knowledgeable about the database." With... As the number of entries increases and the number of valid entries in the two sub-databases accumulates, the average number of clarification rounds required for a single query tends to converge and decrease. This allows the system's personalized service capabilities to enter a positive cycle of continuous self-reinforcement, such as... Figure 3 As shown.

[0061] According to another aspect of the present invention, the present invention provides a query method implemented using the aforementioned structured data query intent alignment system based on continuous user semantic memory, comprising the following steps: S1, receives natural language input from the user.

[0062] S2. Generate vector representations of natural language, perform semantic retrieval in the user's knowledge document library, obtain a set of relevant semantic memory entries, and assemble them together with the database schema to form a context.

[0063] The system receives user natural language queries. Generate its vector representation Execute top- in the user knowledge document of the corresponding user. Semantic retrieval retrieves a set of relevant semantic memory entries. .Will Together with the database schema (including table names, field names, field comments, and core metric definitions), it forms the context input for the LLM. This stage does not involve any LLM calls; it only involves vector retrieval and text concatenation operations, resulting in extremely low end-to-end latency.

[0064] S3. Inject the assembled context into the large language model, execute a synchronous inference call, obtain the structured diagnostic results, and determine whether additional information is needed.

[0065] In some embodiments, the four partitions of the structured diagnostic results are as follows: if the last three partitions are all empty, it is determined that the query has been fully understood and the process jumps directly to S5; otherwise, it proceeds to S4.

[0066] S4. If supplementary information is required, generate and execute an exploration query for the business database based on the items to be explored in the structured diagnostic results. Merge the query results and structured diagnostic results to generate a composite clarification request and present it to the user. After the user responds to the composite clarification request, incorporate the user's response into the semantic state of the current session, return to semantic diagnostics, and execute another synchronous inference call.

[0067] In some embodiments, the LLM generates a composite clarification request based on the diagnostic results and presents it to the user. If db_exploration_items is not empty, the system performs a probing query and embeds the results into the request content before presenting the clarification request. After the user responds, their response is merged into the semantic state of the current session, and execution returns to step S3. The system re-diagnoses at most once to prevent looping.

[0068] S5. When no additional information is required, or after the user responds to a composite clarification request and completes intent confirmation, generate and execute SQL based on the standardized query intent in the confirmed structured diagnostic results, and return the query results to the user.

[0069] In some embodiments, after the user confirms the intent summary, the standardized query intent is passed to the Text-to-SQL engine to generate and execute SQL, and the query results are returned to the user.

[0070] S6. After each complete interaction, extract generalizable semantic knowledge from the record of this complete interaction and write it into the user knowledge document library; when the user confirms the intent summary, write the resolved ambiguities into the user expression profile library used to record the user's semantic expression preferences.

[0071] In some embodiments, this step is an asynchronous background operation. The complete interaction record is passed to an independent LLM inference call, which extracts generalizable semantic knowledge, generates new semantic memory entries, and asynchronously writes them into the user's knowledge document in the vector database. S6 is completely transparent to the user and does not block the return of the result from S5.

[0072] like Figure 4 As shown, the number of synchronous LLM calls in the entire main process is 1 in the optimal path (direct diagnosis passed), and 2 in the path requiring clarification, which meets the basic requirements for response latency in production systems. The Text-to-SQL inference calls are independent of the above process and can be seamlessly integrated with existing mature solutions. This solution does not impose specific constraints on its internal implementation.

[0073] The two core propositions of this invention have clear quantitative verification paths, making them suitable for experimental verification in the implementation schemes. For the proposition that "the system increasingly understands the user," it is possible to track the same user group in continuous... Average number of clarification cycles per use Follow The changing trend. The expected result is... Follow It monotonically increases and converges to a stable value close to 0 after several interactions. For the proposition that "users are becoming increasingly knowledgeable about databases," the frequency of database exploration triggers can be tracked. And the proportion of users actively using standard database field names or precise descriptions in their queries. Follow The changing trend, the expected result is Monotonic decline A monotonically increasing trend, together with these two factors, constitutes quantitative evidence of improved user database awareness. The formal description of the above indicators is:

[0074] If all three trends are true simultaneously, they constitute empirical support for the effectiveness of the core technology claims in this solution.

[0075] To objectively quantify the performance gains of this solution compared to existing solutions, a comparative experiment was conducted on the BIRD-INTERACT public benchmark. BIRD-INTERACT provides two evaluation settings: predefined session protocol (c-Interact) and open autonomous agent interaction (a-Interact). The tasks cover two business scenarios: business intelligence queries and data management queries. Each task is evaluated using executable test cases. This dataset contains 600 PostgreSQL tasks, with typical evaluation triggering 1,968 to 5,496 rounds of interaction between the model and the user simulator. It is currently the most realistic multi-round Text-to-SQL evaluation benchmark for evaluating user query intent clarification, closely resembling the challenges of production-level database assistants. The evaluation metrics used in this experiment cover three categories: priority question success rate (PQ-SR%↑), follow-up question success rate (FU-SR%↑), and final normalized reward (Reward↑). All success rates are calculated cumulatively.

[0076] This experiment selected two mainstream large language models, Deepseek-Chat-V3.1 and Gemini-2.5-Pro, as the backbone. Their original performance under the official BIRD-INTERACT a-Interact (autonomous agent) settings was used as the control baseline. The experimental group was the system performance after fully superimposing this scheme (persistent user knowledge documents, predictive semantic diagnosis, one-time compound clarification and bidirectional cognitive update) on the same backbone model, in order to verify the incremental contribution of the scheme mechanism to the underlying LLM capabilities.

[0077] As shown in Table 4, the experimental results demonstrate that the proposed scheme achieves stable and significant performance improvements on both backbone models. With Deepseek-Chat-V3.1 as the backbone, the overall success rate of prioritizing questions increased from 17.17% to 32.52% (a relative improvement of over 80%), the overall success rate of follow-up questions increased from 4.83% to 12.06% (+8 percentage points, a relative improvement of over 160%), and the final normalized reward increased from 13.47 to 21.52. With Gemini-2.5-Pro ​​as the backbone, the overall success rate of prioritizing questions increased from 20.33% to 31.33% (a relative improvement of over 50%), the overall success rate of follow-up questions increased from 10.33% to 16.33% (+6.00 percentage points, a relative improvement of over 58%), and the final normalized reward increased from 17.33 to 23.17.

[0078] Notably, the relative improvement in the success rate of follow-up questions was significantly higher than that of priority questions in both sets of experiments. This pattern is highly consistent with the theoretical predictions of this scheme: follow-up questions require the system to have a continuous understanding of the semantic context of preceding queries, and the dual persistent memory of EPM and DCPM within and across sessions can provide stronger semantic prior support for follow-up questions than independent priority queries. As the interaction rounds progress, the number of personalized semantic entries accumulated in UKD increases monotonically, and the effective historical knowledge that subsequent tasks can utilize continues to enrich, thereby driving a relatively greater improvement in the success rate of follow-up question tasks. This phenomenon itself constitutes strong empirical evidence for the core claim of this scheme that "system performance self-reinforces with usage time."

[0079] Table 4

[0080] Note: PQ = Priority Question, FU = Follow-Up, BI = Business Intelligence Query, DM = Data Management Query; baseline data comes from the BIRD-INTERACT official benchmark list (a-Interact settings).

[0081] This solution has been successfully deployed and validated in the production information system of a provincial power grid company. The data foundation covers seven core business domains, including marketing metering, dispatching and operation, equipment ledgers, and financial settlement, involving approximately 1,200 business data tables and over 18,000 fields. It also includes numerous non-standard business expressions specific to the company (such as "large-scale power transfer," "high-loss transformer area," "T+1 settlement caliber," and "regional voltage line loss rate"). These expressions are almost entirely absent from general dictionaries and publicly available corpora, which is one of the root causes of numerous ambiguities and failures in traditional NL2SQL solutions. Regarding the operating environment, the vector database uses Milvus to achieve persistent storage and near-nearest neighbor retrieval of user knowledge documents, supporting concurrent access by multiple users and user-level document isolation storage. The large language model calls the company's private deployment endpoint, meeting the data security and compliance requirements of the power industry. The Text-to-SQL engine uses Deepseek-Chat-V3.1 as its backbone. The top-k retrieval parameter is set to k=10, achieving an engineering balance between context token budget and memory coverage. The system has completed full-link integration with the enterprise's existing data platform query interface. The average response latency of the end-to-end main process (including vector retrieval and diagnostic calls) is controlled within 2.8 seconds, meeting the real-time requirements of the production system.

[0082] During the pilot phase, the electricity sales analysis and deviation assessment business of a municipal power supply company was selected as the core application scenario. Twelve business analysts were chosen as the test user group, and the system ran continuously for eight weeks, generating approximately 3,400 natural language query interactions. Key performance indicators are as follows: the initial clarification success rate increased from 41.2% in the baseline system to 79.6% (+38.4 percentage points); the average number of clarification rounds required per query decreased from 2.7 rounds to 0.9 rounds (a decrease of 66.7%); among users who used the system more than 30 times, the proportion of queries with "zero clarification leading directly to results" increased from 8.3% initially to 52.1% in week 8, confirming the core proposition that "the system is increasingly understanding users"; simultaneously, the proportion of users actively using standard database field names and precise descriptions in their queries increased from 7.4% to 31.8%, and the average number of "known" status entries per user in DCPM reached 27.3, confirming the core proposition that "users are increasingly understanding the database". Especially in the sensitive scenario of "electricity sales deviation assessment", the problem of users misusing query results due to confusion between T+1 settlement and real-time metering decreased by about 71% during the pilot period, effectively improving the accuracy of business data decision-making.

[0083] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0084] It should be noted that, depending on the implementation needs, the various steps / components described in this application can be broken down into more steps / components, or two or more steps / components or parts of the operation of steps / components can be combined into new steps / components to achieve the purpose of this invention.

[0085] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A structured data query intent alignment system based on continuous user semantic memory, characterized in that: It includes three horizontal layers and one parallel asynchronous learning layer; among which, The system has three horizontal layers: a user interaction layer, a core processing layer, and a data storage layer. The user interaction layer handles the user's natural language input and the system's output. The core processing layer receives the user's natural language input, performs semantic understanding, ambiguity resolution, and intent confirmation, and finally generates and executes structured query statements, delivering the results to the user interaction layer. The data storage layer manages the user knowledge document library on which the system operates and the business database for storing actual business data. The user knowledge document library includes a user expression profile library for recording user semantic expression preferences and a user database cognitive profile library for tracking user cognitive status of database fields. The asynchronous learning layer runs in parallel with the core processing layer. After each complete interaction, it extracts generalizable semantic knowledge from the record of the complete interaction and writes it into the user knowledge document library.

2. The structured data query intent alignment system based on continuous user semantic memory according to claim 1, characterized in that: The user knowledge document base consists of several discrete semantic memory entries; The core processing layer includes: The context assembly module is used to generate vector representations of the user's natural language, perform semantic retrieval in the user's knowledge document library, obtain a set of relevant semantic memory entries, and assemble them together with the database schema into a context. The semantic diagnosis module is used to inject the assembled context into the large language model, execute a synchronous inference call, obtain structured diagnosis results, and determine whether additional information is needed. The Clarification and Database Probing module is triggered when the semantic diagnosis determines that supplementary information is needed. It is used to generate and execute probing queries against the business database based on the items to be explored in the structured diagnosis results, merge the query results and structured diagnosis results to generate a composite clarification request, and present it to the user. After the user responds to the composite clarification request, the user's response is incorporated into the semantic state of the current session, and the semantic diagnosis is returned to execute another synchronous reasoning call. The intent confirmation and text-to-query module is used to generate and execute SQL based on the standardized query intent in the confirmed structured diagnostic results when no additional information is needed, or after the user responds to a compound clarification request and completes intent confirmation, and return the query results to the user; at the same time, the complete interaction record is passed to the asynchronous learning layer.

3. The structured data query intent alignment system based on continuous user semantic memory according to claim 2, characterized in that: The semantic retrieval is a cosine similarity retrieval, and the set of relevant semantic memory entries obtained is the k most relevant to the current query semantics; k is a preset fixed value used to control the number of context tokens consumed by reasoning.

4. The structured data query intent alignment system based on continuous user semantic memory according to claim 2, characterized in that: Each of the aforementioned semantic memory entries is represented using natural language text as a carrier, and is accompanied by a high-dimensional vector representation generated by a text embedding model to support semantic retrieval; The number of entries in the user knowledge document grows dynamically with each complete interaction and is persistently stored using a vector database.

5. The structured data query intent alignment system based on continuous user semantic memory according to claim 4, characterized in that: Each of the aforementioned semantic memory entries is accompanied by the following metadata: Historical activation frequency represents the cumulative number of times that semantic memory entry has been retrieved and actually used in reasoning; Recent activation timestamp; Source credibility markers indicate whether the information was explicitly confirmed by the user or inferred by the system but has not yet been confirmed by the user. Specifically, based on the aforementioned metadata, a time decay weight is applied to the semantic memory entry during the retrieval ranking, thereby reducing its retrieval priority.

6. The structured data query intent alignment system based on continuous user semantic memory according to claim 2, characterized in that: The asynchronous learning layer is also used to write the resolved ambiguities into a user expression profile library that records the user's semantic expression preferences when the user confirms the intent summary.

7. The structured data query intent alignment system based on continuous user semantic memory according to claim 1, characterized in that: The user expression profile library is used to store the mapping knowledge from non-standard business expressions specific to a particular user, summarized from historical interactions, to standard database terms; The aforementioned non-standard business expressions refer to personalized abbreviations, internal jargon, and business idioms with specific meanings that cannot be parsed by general string matching or public dictionaries.

8. The structured data query intent alignment system based on continuous user semantic memory according to claim 1, characterized in that: The user database cognitive profile library is used to store descriptive knowledge about a specific user's cognitive state regarding the database's logical structure and data characteristics, which is summarized from historical interactions. This includes the rules that the user has mastered, the erroneous assumptions that have occurred, and the cognitive blind spots that still exist. Past erroneous assumptions serve as early warning clues for future queries, while existing cognitive blind spots serve as directions for proactive system guidance. The user database cognitive profile library has a cognitive state field, which is used to mark the rules that have been mastered, the erroneous assumptions that have occurred, and the current cognitive blind spots. The cognitive state field constitutes a dynamically evolving user database knowledge graph, and the quantitative improvement of the user database cognitive level is judged by the state transition marked in the cognitive state field.

9. A query method implemented using the structured data query intent alignment system based on continuous user semantic memory as described in claims 1-8, characterized in that: Includes the following steps: Receives natural language input from the user; Natural language is generated into vector representations, semantic retrieval is performed in the user's knowledge document library to obtain a set of relevant semantic memory entries, and these are assembled into a context together with the database schema. The assembled context is injected into the large language model, a synchronous inference call is executed, the structured diagnostic results are obtained, and it is determined whether additional information is needed. If additional information is needed, an exploration query for the business database is generated and executed based on the items to be explored in the structured diagnostic results. The query results and structured diagnostic results are then merged to generate a composite clarification request, which is presented to the user. After the user responds, the user's response is incorporated into the semantic state of the current session, and the semantic diagnostic is returned to execute another synchronous inference call. When no additional information is required, or after the user responds to a compound clarification request and completes intent confirmation, SQL is generated and executed based on the standardized query intent in the confirmed structured diagnostic results, and the query results are returned to the user. After each complete interaction, generalizable semantic knowledge is extracted from the record of this complete interaction and written into the user knowledge document library.

10. The query method according to claim 9, characterized in that: When a user confirms the intent summary, the resolved ambiguities are written into a user expression profile library used to record the user's semantic expression preferences.