Power equipment wide table query method and system based on multi-granularity vector semantic index

By using multi-granularity vector semantic indexing and reinforcement learning optimization, the semantic gap and uncontrollable performance issues in wide table queries of power equipment ledgers have been resolved, achieving efficient and accurate natural language queries and improving the system's stability and response efficiency.

CN121807844APending Publication Date: 2026-04-07SHANDONG LUNENG SOFTWARE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies suffer from semantic density mismatch, structural ambiguity of query intent, and uncontrollable SQL query performance issues in wide table queries of power equipment ledgers, resulting in low efficiency and poor stability when the system handles complex queries.

Method used

By employing a multi-granularity vector semantic indexing method, and constructing device-level and attribute-level semantic indexes, combined with routing decision models and reinforcement learning, efficient SQL query statements are generated, enabling precise decomposition and optimization of complex queries.

Benefits of technology

It improves query response efficiency, enhances the accuracy and performance of SQL generation, ensures high availability and stability of the system under massive data, and can dynamically adapt to users' complex and ambiguous natural language query intentions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121807844A_ABST
    Figure CN121807844A_ABST
Patent Text Reader

Abstract

The invention discloses a power equipment wide table query method and system based on multi-granularity vector semantic indexing, and relates to the technical field of intelligent information retrieval. The method comprises the following steps: acquiring table structure information in a database table, and preprocessing the table structure information; constructing a device-level semantic index to extract coarse-grained information, constructing an attribute-level semantic index to extract fine-grained features, and forming a query feature vector according to the coarse-grained information and the fine-grained features; and executing a routing path on the query feature vector by using a routing decision model, and guiding an SQL query process based on reinforcement learning to generate an SQL statement. According to the method, efficient, accurate and self-adaptive natural language query can be carried out on large-scale and multi-source heterogeneous electrical equipment ledger data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent information retrieval technology, and in particular to a method and system for querying a wide table of power equipment based on multi-granularity vector semantic indexing. Background Technology

[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.

[0003] Due to the standardized management of power equipment ledger data, it exhibits highly structured but semantically highly encoded characteristics in the database. Existing Natural Language to SQL (NL2SQL) based solutions face three major technical bottlenecks when directly applied to this scenario: (1) Semantic density mismatch problem: The underlying database stores low semantic density symbolic encoding, while user queries use high semantic density natural language. Traditional NL2SQL models have difficulty establishing an accurate mapping relationship between the two on their own.

[0004] (2) Structural ambiguity of query intent: User queries may simultaneously contain exact match intent, semantic generalization intent, and conditional filtering intent. A single query processing engine cannot optimally handle such mixed intents.

[0005] (3) Uncontrollable SQL query performance: The NL2SQL model is a generative model, and the execution plan of its output SQL statements in the database is unpredictable. It is very easy to generate inefficient queries that lead to full table scans. When the data volume of the wide table reaches hundreds of millions, such queries will cause the system to become unavailable.

[0006] In addition, existing solutions mostly rely on single vector retrieval or rule-based query rewriting, failing to fundamentally address the aforementioned issues from an architectural perspective, resulting in a difficulty in balancing system accuracy, performance, and versatility. Summary of the Invention

[0007] To address the shortcomings of existing technologies, the purpose of this invention is to provide a method and system for querying wide tables of power equipment based on multi-granularity vector semantic indexing, which can achieve efficient, accurate and adaptive natural language querying of large-scale, multi-source heterogeneous power equipment ledger data.

[0008] To achieve the above objectives, the present invention is implemented through the following technical solution: The first aspect of this invention provides a method for querying a wide table of power equipment based on multi-granularity vector semantic indexing, comprising the following steps: Retrieve table structure information from database tables and preprocess the table structure information; A device-level semantic index is constructed to extract coarse-grained information, and an attribute-level semantic index is constructed to extract fine-grained features. A query feature vector is then formed based on the coarse-grained information and fine-grained features. The routing decision model is used to execute routing paths for query feature vectors, and reinforcement learning is used to guide the SQL query process and generate SQL statements.

[0009] A second aspect of the present invention provides a wide table query system for power equipment based on multi-granularity vector semantic indexing, comprising: The data acquisition module is configured to acquire table structure information from database tables and preprocess the table structure information. The vector indexing module is configured to build a device-level semantic index to extract coarse-grained information, build an attribute-level semantic index to extract fine-grained features, and form a query feature vector based on the coarse-grained information and fine-grained features. The routing decision module is configured to use the routing decision model to execute routing paths for query feature vectors and guide the SQL query process based on reinforcement learning to generate SQL statements.

[0010] A third aspect of the present invention provides a computer-readable storage medium storing a computer program adapted for loading by a processor and executing steps in the power equipment wide table query method based on multi-granularity vector semantic indexing as described in the first aspect of the present invention.

[0011] A fourth aspect of the present invention provides a computer device comprising: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the power equipment wide table query method based on multi-granularity vector semantic index as described in the first aspect of the present invention.

[0012] A fifth aspect of the present invention provides a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in the power equipment wide table query method based on multi-granularity vector semantic indexing as described in the first aspect of the present invention.

[0013] The above one or more technical solutions have the following beneficial effects: This invention discloses a method and system for querying wide tables of power equipment based on multi-granularity vector semantic indexing. Its fundamental purpose is to solve the core bottleneck problems faced by existing NL2SQL technology in wide table query scenarios for power equipment ledgers, such as semantic density mismatch, structural ambiguity of query intent, and uncontrollable SQL performance. Through a systematic architectural innovation of "multi-granularity semantic indexing + intelligent routing decision + reinforcement learning optimization," it achieves a synergistic leap in the accuracy, performance, and robustness of NL2SQL technology in complex enterprise-level power data scenarios, and endows the system with the ability to continuously evolve. This invention, through an inference-time optimization mechanism, achieves continuous improvement in SQL generation quality while fine-tuning large model parameters. It can automatically optimize suggestion strategies based on historical experience and dynamically adjust generation parameters, effectively improving the accuracy, performance, and business relevance of SQL.

[0014] This invention leverages deep semantic support provided by multi-granularity vector semantic indexing, and relies on an intelligent semantic routing controller to precisely decompose complex natural language queries and plan optimal execution paths. This transforms global fuzzy searches into precise queries targeting highly relevant subsets of data, thereby improving query response efficiency by more than an order of magnitude. Furthermore, combined with continuous optimization using a reinforcement learning framework, the system achieves a qualitative leap in its understanding of users' complex and fuzzy natural language query intentions, fundamentally solving the semantic gap problem.

[0015] This invention aims to construct a semantic mapping layer. By creating multi-granularity vector semantic indexes, it unifies and accurately vectorizes the low-semantic-density symbolic encoding stored at the bottom layer with the high-semantic-density natural language used in user queries. This directly establishes and solidifies the semantic equivalence relationship between the two in the vector space, completely eliminating the difficulty for the NL2SQL model to learn this mapping on its own. Through the physical access constraints provided by the vector indexes and the guidance of reinforcement learning for efficient SQL patterns, it effectively prevents performance-degrading operations such as full table scans, ensuring high availability and stability of the system when facing massive amounts of data and complex queries.

[0016] The present invention aims to design an intelligent semantic routing and query decomposition engine that can automatically identify and deconstruct the precise matching intent, semantic generalization intent, and conditional filtering intent mixed in the user's natural language query, and dynamically plan the optimal execution path for different types of intent subtasks, thereby overcoming the performance and accuracy trade-off dilemma faced by a single query processing engine when processing mixed intents.

[0017] In the SQL generation phase, this invention utilizes a reinforcement learning framework to enable the model to deeply understand the distribution characteristics and access patterns of power data, actively learning to generate efficient SQL syntax that leverages database indexes. These two mechanisms work synergistically, significantly reducing performance degradation phenomena such as full table scans through both pre-constraint and post-optimization, ensuring system stability and high availability even with hundreds of millions of data points.

[0018] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0019] 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 of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart of the power equipment wide table query method based on multi-granularity vector semantic index in Embodiment 1 of the present invention; Figure 2 This is a flowchart of the multi-granularity vector indexing process in Embodiment 1 of the present invention; Figure 3 This is a flowchart of semantic routing and query execution in Embodiment 1 of the present invention; Figure 4 This is a flowchart of the reinforcement learning process in Embodiment 1 of the present invention. Detailed Implementation

[0021] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0022] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof. The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0023] Example 1: Embodiment 1 of this invention provides a method for querying a wide table of power equipment based on multi-granularity vector semantic indexing, such as... Figure 1 As shown, it includes the following steps: Step 1: Obtain the table structure information from the database table and preprocess the table structure information.

[0024] In one specific implementation, the table structure information in the database tables is compiled and summarized. For all fields in the table structure information that store dictionary codes, the field values ​​are replaced with directly readable semantic tags by querying a common dictionary table.

[0025] Step 2: Construct a device-level semantic index to extract coarse-grained information, construct an attribute-level semantic index to extract fine-grained features, and form a query feature vector based on the coarse-grained information and fine-grained features.

[0026] like Figure 2 As shown, the specific steps are as follows: Step 2.1: Construct a device-level semantic index to extract coarse-grained information.

[0027] In one specific implementation, this embodiment constructs a device-level semantic index to index a single complete piece of device information.

[0028] Step 2.1.1: First, generate a semantic summary.

[0029] Specifically, it generates a structured natural language description, or semantic summary, for the device. The template is as follows: "This is device [device_type], model [model], located at substation [substation_name], voltage level [voltage_level], manufactured by [manufacturer], currently in [psr_state], and managed by [city]." Step 2.1.2: Utilize device-level semantic embedding models semantic summarization Encode to generate the semantic vector of the current device. In this embodiment, the BAAI / bge-large-zh-v1.5 model is used as the device-level semantic embedding model. In some other embodiments, other semantic embedding models may also be used.

[0030] Step 2.1.3: Store the semantic vectors in the vector database.

[0031] Specifically, a table named device_level_index is created in the vector database, containing fields device_id and device_vector, to store the unique identifier and vector representation of each device.

[0032] Step 2.2: Construct an attribute-level semantic index to extract fine-grained features.

[0033] In one specific implementation, this embodiment constructs an attribute-level semantic index to index each key field in the data table and all its possible values. This index is specifically designed to solve the semantic matching problem between fields and values ​​in query conditions, improving retrieval accuracy and recall through fine-grained vector representation.

[0034] Step 2.2.1: Obtain the set of all deduplicated semantic tag values ​​for each field.

[0035] Specifically, iterate through the set of all fields that need to be indexed. For each field Get the set of all deduplicated semantic tag values. .

[0036] Step 2.2.2: Utilize an embedding model focused on short text understanding Generate field name vectors respectively and field value vector For each .

[0037] It is important to note that the embedding model For existing models in this field, it is sufficient to generate field name vectors and field value vectors; the specific process will not be elaborated here.

[0038] Step 2.2.3: Store the field name vector and field value vector in the vector database.

[0039] Specifically, create a table named `attribute_level_index` in the vector database. It contains fields `field_name`, `field_value`, `field_vector`, and `value_vector`, used to store each field name, field value, and their vector representation.

[0040] Step 2.3: Form a query feature vector based on coarse-grained information and fine-grained features.

[0041] In one specific implementation, the user query The data is fed into two dedicated encoders, one for device-level semantic indexing and the other for attribute-level semantic indexing, to obtain semantic representations oriented towards devices and attributes: .

[0042] Based on the aforementioned vector and text rules, a query feature vector is constructed. It includes the following three key features: (1) Calculate the peak of semantic similarity of devices (Sim_device_peak).

[0043] .

[0044] in, The peak value of device semantic similarity. This is the embedding vector for device-related semantics in the query; For the first in the database A pre-computed embedding vector for each device entity (generated based on structured semantic summarization). This metric measures the maximum semantic match between the query and any given device entity, with a value range of [value range missing]. A higher value indicates a more specific device designation.

[0045] (2) Calculate the attribute matching confidence score (Conf_attr).

[0046] .

[0047] in, Match confidence scores for attributes. This is the embedding vector of the condition values ​​or descriptive text related to the attributes in the query; Top- in attribute index Embedding vectors of the most relevant candidate values; The corresponding weight (usually decays with sorting position, such as...) This metric reflects the clarity of a user's intent regarding attribute values. The higher the Conf_attr, the more specific the query conditions and the stronger the matching ability.

[0048] (3) Query text rule features.

[0049] Structured signals are extracted using lightweight rule matching, including: Does it contain a unique device identifier (such as a device ID, which can be identified using a regular expression)?

[0050] Does it include comparison operators (such as ">", "<", "≥", etc.)?

[0051] Whether it contains generalized semantic keywords (such as "similar", "close", "series", "same type", etc., matched by a predefined keyword list).

[0052] The above three types of features together constitute the query feature vector. As input to the subsequent routing decision model, it comprehensively characterizes the semantic features of queries in three dimensions: device reference, attribute constraints, and language pattern.

[0053] Step 3: Utilize the routing decision model to execute routing paths for the query feature vectors, and guide the SQL query process based on reinforcement learning to generate SQL statements.

[0054] like Figure 3 As shown, the specific steps are as follows: Step 3.1: Execute the routing path for the query feature vector using the routing decision model.

[0055] In one specific implementation, this embodiment employs a gradient boosting decision tree (GBDT) model. As a semantic routing classifier, the constructed query feature vector Input: Routing decision : .

[0056] in, For routing decisions.

[0057] Step 3.1.1: Determine the routing status of the query feature vector according to the feature threshold rules.

[0058] In one specific implementation, the routing decision value is determined according to a feature threshold rule (the threshold has been experimentally verified). The feature threshold rule includes routing scenarios such as precise routing, semantic generalization routing, conditional filtering routing, and hybrid routing. Among them, precise routing prioritizes the use of device-level semantic indexes to directly locate the target device; semantic generalization routing is suitable for scenarios where user queries involve device categories, series, or fuzzy references; conditional filtering routing prioritizes the use of attribute-level semantic indexes to accurately filter the set of devices that meet the conditions through field-value matching; hybrid routing calls device-level semantic indexes and attribute-level semantic indexes in parallel, merges multi-source results, and performs post-processing, which is suitable for complex or multi-condition joint queries.

[0059] The specific judgment logic is as follows: Precise routing: When the peak semantic similarity of devices is high, that is Experimental measurements If the query displays a unique device identifier (such as device ID), it is determined to be an exact route.

[0060] Semantic generalized routing: When the peak semantic similarity of devices is at a medium level, that is ,in Furthermore, the confidence level of attribute matching is low, that is... , When this occurs, it is determined to be a semantically generalized route.

[0061] Conditional route filtering: When the confidence level of attribute matching is high, that is When this occurs, it is determined to be a condition-filtered route.

[0062] Hybrid routing: A query is considered a hybrid route if any of the following conditions are met: Mixed Intents: Queries that simultaneously satisfy and .

[0063] Boundary ambiguity: The threshold for determining the proximity of key feature values ​​to the aforementioned routes, for example... and

[0064] or The absolute value of the difference is less than 0.05, or and The absolute value of the difference is less than 0.05.

[0065] Rule conflict: The query text simultaneously identifies strong signals pointing to different routes, such as containing both precise device identifiers (e.g., specific model numbers) and semantically generalized keywords (e.g., "similar" or "same series"). in, This is a high confidence threshold used to identify queries that have a very high semantic match with a specific device entity. This is the lower confidence limit, used to define the starting threshold for semantic matching of devices. If the value is lower than this, the query is considered to have a very weak correlation with the device entity. This is the threshold for condition judgment, used to determine the explicitness of attribute conditions. If the value is higher than this, the query is considered to contain specific and precisely matchable attribute filtering intent.

[0066] Step 3.1.2: Execute the routing path based on the routing information.

[0067] In one specific implementation, the routing paths include path A, path B, and path C. Path A is executed when the routing is exact matching or semantic generalization; path A aims to improve query accuracy and recall through exact matching or semantic generalization. Path B is executed when the routing is condition-filtered; path B focuses on fine-grained analysis and high-confidence matching of the attribute conditions in the query to ensure the accuracy of the query results. Path C is executed when the routing is a mixed routing.

[0068] The detailed routing path is as follows: Execution path A: Retrieve the most similar device: in device_level_index, based on the previously calculated device semantic vector. Retrieve the K devices that are most similar to it and obtain the candidate ID set Candidates.

[0069] Construct an enhanced query instruction: Create an enhanced query instruction Q_enhanced with the template: "Original query: [Q]. Note that the result must satisfy the following constraint: the device ID must be in the list [Candidates]. Please understand and generate the SQL based on this." This step aims to add the initially retrieved device information as an additional constraint to the original query to guide the subsequent SQL generation process to be more accurate.

[0070] Input to NL2SQL engine: Input the enhanced query command Q_enhanced constructed above into the Natural Language to SQL (NL2SQL) engine for final query transformation and execution.

[0071] Execution path B.

[0072] Attribute semantic matching: For query Q, calculate its overall similarity to each (field, value) pair in attribute_level_index: .

[0073] in, The overall similarity of (field, value) pairs. For field (field), For value (attribute value) As a harmonic parameter, the experimental value was set to 0.3 to balance the similarity weights between field names and field values.

[0074] Execution path C (i.e., simultaneously initiating the execution flow of paths A and B): Path A branch: Input the original query Q into the device-level semantic index to obtain the candidate device ID set Candidates_A based on device semantics.

[0075] Path B branch: The original query Q is input into the attribute-level semantic index for attribute semantic matching, generating a high-confidence condition set HC, which then guides the NL2SQL engine to generate an SQL query. Executing this SQL query yields a candidate device ID set Candidates_B based on attribute filtering.

[0076] Finally, the intersection of the two sets Candidates_A and Candidates_B is taken to obtain the final set of candidate devices.

[0077] Step 3.1.3: Query the corresponding SQL statement based on the routing path results.

[0078] Retrieving field-value pairs and calculating similarity: Field-value pairs (field, value) are pre-enumerated and quantized before being stored in the database during the construction of the attribute-level semantic index. During a query, the system calculates the similarity between the query vector V_q_attr and all pre-stored (field, value) pairs in the index, assigning a score to each pair. Set a threshold θpair. If the similarity of a (field, value) pair is... If the value is greater than θpair, then there is a high degree of confidence that this pair should be used as a query condition.

[0079] This embodiment distinguishes between the different objectives of two distinct stages: "routing decision" and "query construction." The routing decision stage (see Conf_attr) determines the user's overall query intent type. The query construction stage (see θpair) generates high-quality, high-precision SQL query statements.

[0080] The high-confidence condition set is selected based on the similarity score S_f,v. The top-N (field, value) pairs with similarity exceeding the threshold θpair (set to 0.88) are considered high-confidence matching conditions, thus forming the high-confidence condition set HC. HC (high-confidence condition set) is the output and result of generating the SQL query statement in path B. It will be directly used to guide and constrain subsequent NL2SQL models to generate the final executable SQL statement. It is a crucial and reliable intermediate representation in the process of converting "user natural language" to "machine-executable SQL".

[0081] Here, θpair is the confidence threshold for field-value pair matching. It is used during the execution of route filtering based on path B conditions to filter out those (field, value) pairs that are highly relevant to the semantics of the current query and can be considered as explicit query conditions of the user from a massive number of (field, value) pairs with calculated similarity.

[0082] Constructing a guided query instruction: Based on the selected high-confidence condition set HC, construct the guided query instruction Q_guided: "Original query: [Q]. After semantic analysis, the query is highly likely to contain the following precise conditions: HC. Please prioritize these conditions when generating SQL." This step aims to emphasize the most likely attribute conditions in the query, thereby guiding the SQL generation process to be closer to the user's intent.

[0083] In this embodiment, the initial template of the guided query instruction Q_guided is preset, while the optimized template is obtained from subsequent reinforcement learning.

[0084] Input to NL2SQL engine: The constructed guided query instruction Q_guided is input into the NL2SQL engine to complete the transformation and execution of the query SQL statement.

[0085] Step 3.2: Guide the SQL query process based on reinforcement learning.

[0086] In one specific implementation, such as Figure 4 As shown, this embodiment does not directly update the massive parameters of the LLM (Large Language Model), but instead uses the reward signal generated by reinforcement learning to dynamically optimize the model's generation strategy during the inference-time stage, thereby achieving effective control over the quality of SQL generation.

[0087] Step 3.2.1: Generate a task based on SQL and model the problem using Markov decision-making.

[0088] Specifically, the SQL generation task is modeled as a Markov Decision Process (MDP): State (s) t ): Defined as the concatenation of the current enhanced query command, database schema information, and historical feedback information, i.e., s t = [Q_guided; Schema_info; H_feedback], serving as the input context for the LLM.

[0089] Action (a) t ): Defined as LLM based on the current state s t The generated complete SQL query statement, i.e., a t=SQLquery.

[0090] award( Design a composite reward function to quantitatively evaluate the overall quality of the generated SQL. The calculation formula is as follows: Among them, R syntax As a reward for grammatical correctness, validation is performed using a database parser; R semantic For semantic accuracy rewards, a comprehensive calculation is performed by comparing the Jaccard similarity of the execution result with the standard answer and the vectorized average reciprocal ranking; R performance For performance rewards, an exponential decay calculation is performed based on the analysis results of execution time and query plan; R feedback The rewards are manually adjusted, with multi-dimensional scoring and normalization performed by humans.

[0091] Step 3.2.2: Optimize the SQL statement generation based on the modeling results.

[0092] Step 3.2.2.1: Dynamic prompt optimization.

[0093] Specifically, an optimal suggestion template library is built based on reward signals from historical queries. The most suitable suggestion template is dynamically selected based on the current query characteristics. Historical optimization experience is incorporated into the suggestions.

[0094] Step 3.2.2.2: Multiple candidate generation and reordering.

[0095] Specifically, using the thought chain technique, the LLM generates multiple candidate SQL statements and execution plans for analysis. Then, a reward prediction model is built to quickly score the candidate SQL statements. The final score is calculated using the following function: .

[0096] Where `syntax_score` is the syntax correctness score, `performance_est` is the performance estimate score, and `similarity` is the semantic similarity score. A weighted linear combination is typically used to balance the contributions of syntax, performance, and semantics. The SQL with the highest overall score is selected as the final output.

[0097] Step 3.2.2.3: Parameter adaptive adjustment.

[0098] The control strategy is defined by the following two core formulas: (1) Formula for dynamic adjustment of temperature parameters.

[0099] The temperature parameter is used to control the randomness of the model output. Its dynamic adjustment formula is defined as follows: .

[0100] in, For temperature parameters, The base temperature value is usually set to a low value (such as 0.3) to ensure the stability of the results generated by simple queries. The query complexity factor is a normalized value calculated based on features such as query length, number of conditions, and semantic ambiguity. . This is an adjustment factor used to control the magnitude of the impact of complexity; an empirical value is usually set to 0.5.

[0101] The optimization goal of this formula is to appropriately increase the temperature when faced with complex queries to stimulate the model's exploratory ability, generate diverse candidate SQLs, and avoid getting trapped in local optima.

[0102] (2) Adaptive strategy for kernel sampling parameters.

[0103] The kernel sampling parameter controls the range of candidate words generated by the model. Its adaptive strategy is described below: .

[0104] in, For kernel sampling parameters, The base kernel sampling value is typically set to 0.8 to 0.9 to maintain a certain level of diversity. Historical performance scores are calculated based on the execution efficiency and correctness of SQL generated from similar queries. . This is the performance feedback coefficient, which controls the degree to which historical performance affects current parameters. For the pruning function, ensure the parameters are within the valid range. Inside, The preset boundary parameters represent respectively The minimum and maximum values ​​allowed for dynamic adjustment are (0.5, 0.95).

[0105] The logic behind this strategy is: when a specific type of query has historically performed poorly ( When the value is low, the system will reduce the top_p value, narrow the range of candidate words, and force the model to use more conservative and certain words, thereby avoiding known low-performance patterns.

[0106] Step 3.2.2.4: Real-time feedback learning.

[0107] Specifically, the system collects the final reward signal for each query online, updates the prompt template library and parameter mapping table in real time, and establishes a query pattern memory to avoid repeating errors.

[0108] Example 2: Embodiment 2 of the present invention provides a wide table query system for power equipment based on multi-granularity vector semantic indexing, comprising: The data acquisition module is configured to acquire table structure information from database tables and preprocess the table structure information. The vector indexing module is configured to build a device-level semantic index to extract coarse-grained information, build an attribute-level semantic index to extract fine-grained features, and form a query feature vector based on the coarse-grained information and fine-grained features. The routing decision module is configured to use the routing decision model to execute routing paths for query feature vectors and guide the SQL query process based on reinforcement learning to generate SQL statements.

[0109] Example 3: Embodiment 3 of the present invention provides a computer-readable storage medium storing a computer program adapted for loading by a processor and executing the steps in the power equipment wide table query method based on multi-granularity vector semantic index as described in Embodiment 1 of the present invention.

[0110] Example 4: Embodiment 4 of the present invention provides a computer device, the device comprising: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the steps in the power equipment wide table query method based on multi-granularity vector semantic index as described in Embodiment 1 of the present invention.

[0111] Example 5: Embodiment 5 of the present invention provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in the power equipment wide table query method based on multi-granularity vector semantic indexing as described in Embodiment 1 of the present invention.

[0112] The steps and methods involved in Examples 2, 3, 4 and 5 above correspond to those in Example 1. For specific implementation methods, please refer to the relevant description section of Example 1.

[0113] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. 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. In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data processing device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, an optical medium, or a semiconductor medium, etc. The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for querying a wide table of power equipment based on multi-granularity vector semantic indexing, characterized in that, Includes the following steps: Retrieve table structure information from database tables and preprocess the table structure information; A device-level semantic index is constructed to extract coarse-grained information, and an attribute-level semantic index is constructed to extract fine-grained features. A query feature vector is then formed based on the coarse-grained information and fine-grained features. The routing decision model is used to execute routing paths for query feature vectors, and reinforcement learning is used to guide the SQL query process and generate SQL statements.

2. The power equipment wide table query method based on multi-granularity vector semantic index as described in claim 1, characterized in that, The specific steps for preprocessing table structure information are as follows: For all fields in the table structure information that store dictionary codes, the field values ​​are replaced with directly readable semantic tags by querying the common dictionary table.

3. The power equipment wide table query method based on multi-granularity vector semantic index as described in claim 1, characterized in that, The specific steps for constructing a device-level semantic index to extract coarse-grained information are as follows: First, generate a semantic summary; The semantic summary is encoded using a device-level semantic embedding model to generate the semantic vector of the current device; The semantic vectors are stored in a vector database.

4. The power equipment wide table query method based on multi-granularity vector semantic index as described in claim 1, characterized in that, The specific steps for constructing an attribute-level semantic index to extract fine-grained features are as follows: Retrieve the set of all deduplicated semantic tag values ​​for each field; An embedding model focused on short text understanding is used to generate field name vectors and field value vectors, respectively. Store the field name vector and field value vector in a vector database.

5. The power equipment wide table query method based on multi-granularity vector semantic index as described in claim 1, characterized in that, The specific steps for executing a routing path for a query feature vector using a routing decision model are as follows: The routing status of the query feature vector is determined based on the feature threshold rule; Execute the routing path based on the routing information; Query the corresponding SQL statement based on the routing path results.

6. The power equipment wide table query method based on multi-granularity vector semantic index as described in claim 5, characterized in that, The feature threshold rules include routing scenarios for precise routing, semantic generalization routing, conditional filtering routing, and hybrid routing. Among them, precise routing prioritizes the use of device-level semantic indexes to directly locate the target device; semantic generalization routing is suitable for scenarios where user queries involve device categories, series, or fuzzy references; conditional filtering routing prioritizes the use of attribute-level semantic indexes to precisely filter the set of devices that meet the conditions through field-value matching; hybrid routing calls device-level semantic indexes and attribute-level semantic indexes in parallel, merges multi-source results, and performs post-processing, which is suitable for complex or multi-condition joint queries.

7. A wide table query system for power equipment based on multi-granularity vector semantic indexing, characterized in that, include: The data acquisition module is configured to acquire table structure information from database tables and preprocess the table structure information. The vector indexing module is configured to build a device-level semantic index to extract coarse-grained information, build an attribute-level semantic index to extract fine-grained features, and form a query feature vector based on the coarse-grained information and fine-grained features. The routing decision module is configured to use the routing decision model to execute routing paths for query feature vectors and guide the SQL query process based on reinforcement learning to generate SQL statements.

8. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the power equipment wide table query method based on multi-granularity vector semantic index as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and executed as described in any one of claims 1-6.

10. A computer device, characterized in that, include: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the power equipment wide table query method based on multi-granularity vector semantic index as described in any one of claims 1-6.