Enhanced application method and device of semantic analysis model, equipment and storage medium

By performing field semantic enhancement and constraint enhancement on the semantic parsing training set, an adapted semantic parsing model is generated, which solves the problem of low accuracy in generating SQL query statements by existing models and achieves higher accuracy and precision.

CN120832889AActive Publication Date: 2025-10-24MATRIX ORIGIN (SHENZHEN) INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511309465.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-15
Publication Date
2025-10-24
Estimated Expiration
2045-09-15

AI Technical Summary

Technical Problem

Existing semantic parsing models suffer from low accuracy in generating SQL queries when converting natural language queries, especially in scenarios with multiple constraints or complex table joins, making it difficult to meet practical needs.

Method used

By performing field semantic enhancement operations on the preset semantic parsing training set, structured training samples are generated, and constraint enhancement processing is performed to generate an enhanced training sample set containing multiple constraint logics. The pre-trained language model is then fine-tuned to generate an adapted semantic parsing model. Finally, the model is used to filter and simplify the table structure and generate SQL query statements.

Benefits of technology

It improves the model's ability to accurately grasp field semantics, enhances its ability to handle multi-constraint logic, improves the accuracy of generated SQL query statements, and reduces the interference of irrelevant information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120832889A_ABST
    Figure CN120832889A_ABST
Patent Text Reader

Abstract

The invention discloses an enhancement application method and device of a semantic analysis model, equipment and a storage medium, and the method comprises the steps: carrying out the field semantic enhancement operation of a preset semantic analysis training set, and generating a structured training sample containing example data; executing constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multi-constraint logic; inputting the enhanced training sample set into a pre-training language model for fine tuning to obtain a semantic analysis model; and inputting a preset semantic analysis verification set into the semantic analysis model, screening out a simplified table structure based on the semantic analysis verification set through the semantic analysis model, and generating a corresponding SQL query statement based on the simplified table structure. Through sample enhancement and model fine tuning, semantic analysis accuracy and scene adaptability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of natural language processing, and in particular to a semantic parsing model enhancement application method and device, equipment and a storage medium. BACKGROUND

[0002] In the field of natural language processing, converting a user's natural language query into a structured SQL query statement is one of the key technologies for realizing intelligent interaction with a database.

[0003] However, due to the ambiguity of natural language expression, the complexity of database table structure and the diversity of user query intent, existing models often face problems such as semantic mapping deviation and table structure screening redundancy in actual application, resulting in deviation between the generated SQL query statement and the user's real demand, especially in scenarios involving multiple constraint conditions or complex table association, the accuracy is difficult to meet actual demand. Based on this, the present application proposes a semantic parsing model enhancement application method. SUMMARY

[0004] The main purpose of the present application is to provide a semantic parsing model enhancement application method, device, equipment and storage medium, aiming to solve the technical problem of low accuracy of generated SQL query statements in the process of converting natural language queries into SQL queries by existing semantic parsing models.

[0005] To achieve the above purpose, the present application provides a semantic parsing model enhancement application method, which comprises the following steps: Performing field semantic enhancement operation on a preset semantic parsing training set to generate a structured training sample containing example data; Performing constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multiple constraint logics; Inputting the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic parsing model; Inputting a preset semantic parsing verification set into the semantic parsing model, filtering out a simplified table structure based on the semantic parsing verification set by the semantic parsing model, and generating a corresponding SQL query statement based on the simplified table structure.

[0006] In an embodiment, the step of performing field semantic enhancement operation on a preset semantic parsing training set to generate a structured training sample containing example data comprises: Extracting field names, corresponding database identifiers and table names in the semantic parsing training set; Based on the field names, database identifiers and table names, associating to a preset structured database, and extracting actual data corresponding to the field names from the structured database as example data; The example data is associated with the field name to form a structured training sample including a field name and example data correspondence.

[0007] In an embodiment, the step of performing constraint enhancement processing on the structured training sample to generate an enhanced training sample set including multi-constraint logic comprises: Based on a preset constraint rule library, constraint requirement feature analysis is performed on the SQL query statement of each training sample in the structured training sample; According to the analysis result, the corresponding query constraint condition is automatically matched from the constraint rule library, and the query constraint condition is added to the SQL query statement of the training sample to generate an enhanced training sample set including multi-constraint logic.

[0008] In an embodiment, the enhanced training sample set includes a first semantic parsing task, and the step of inputting the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic parsing model comprises: Based on the first semantic parsing task, a preset number of trainable parameters are added to the attention module of the pre-trained language model, the original parameters of the pre-trained language model are fixed, the newly added trainable parameters are adjusted using the enhanced training sample set, and a semantic parsing model adapted to the first semantic parsing task is generated.

[0009] In an embodiment, the step of inputting the enhanced training sample set into a pre-trained language model for fine-tuning further comprises: Using a distributed computing architecture, the enhanced training sample set and the model parameters of the pre-trained language model are distributed to multiple computing nodes; For the training process of the newly added trainable parameters, the training effect of different combinations of learning rate and weight decay coefficient is tested by iteration to determine the optimal hyperparameter combination that makes the newly added trainable parameters adapt to the first semantic parsing task; Based on the distributed computing architecture and the optimal hyperparameter combination, the newly added trainable parameters are trained and adjusted.

[0010] In an embodiment, the semantic parsing verification set includes a second semantic parsing task, and the step of filtering a simplified table structure by the semantic parsing model based on the semantic parsing verification set comprises: The semantic parsing model evaluates the relevance of each table and field in the database associated with the semantic parsing verification set and the semantic parsing task, and based on the evaluation result, the table structure related to the second semantic parsing task is filtered from the semantic parsing verification set to form the simplified table structure.

[0011] In an embodiment, the step of generating a corresponding SQL query statement based on the simplified table structure comprises: mapping, by the semantic parsing model, a task intention of the second semantic parsing task to the simplified table structure to generate a query statement conforming to the SQL standard.

[0012] In addition, to achieve the above object, the present application also provides an enhanced application device of a semantic parsing model, which comprises: A first preprocessing module is configured to perform field semantic enhancement operation on a preset semantic parsing training set to generate a structured training sample containing example data. A second preprocessing module is configured to perform constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multi-constraint logic. A model training module is configured to input the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic parsing model. A verification generation module is configured to input a preset semantic parsing verification set into the semantic parsing model, filter out a simplified table structure based on the semantic parsing verification set by the semantic parsing model, and generate a corresponding SQL query statement based on the simplified table structure.

[0013] In addition, to achieve the above object, the present application also provides a terminal device, which comprises a memory, a processor, and an enhanced application program of a semantic parsing model stored on the memory and executable on the processor, and the enhanced application program of the semantic parsing model, when executed by the processor, implements the steps of the enhanced application method of the semantic parsing model.

[0014] In addition, to achieve the above object, the present application also provides a computer readable storage medium, which stores an enhanced application program of a semantic parsing model, and the enhanced application program of the semantic parsing model, when executed by a processor, implements the steps of the enhanced application method of the semantic parsing model.

[0015] The one or more technical solutions provided by the present application have at least the following technical effects: The application generates a structured training sample containing example data by performing a field semantic enhancement operation on a preset semantic parsing training set, which can enable the model to more intuitively understand the actual meaning of the field and the data distribution characteristics during the training process, thereby improving the accurate grasping ability of the field semantics. By performing constraint enhancement processing on the structured training sample, an enhanced training sample set containing multiple constraint logics is generated, which helps the model to learn and master complex constraint condition combinations and enhances its ability to process multiple constraint logics. The semantic parsing model obtained by inputting the enhanced training sample set into the pre-trained language model for fine-tuning can better adapt to different scenarios and requirements when facing various semantic parsing tasks. By inputting the preset semantic parsing verification set into the semantic parsing model, the semantic parsing model can filter out simplified table structures and generate corresponding SQL query statements based on the verification set, which can effectively reduce the interference of irrelevant information, improve the filtering accuracy of the model on the table structure, and further improve the accuracy of generating SQL query statements. BRIEF DESCRIPTION OF DRAWINGS

[0016] Figure 1 A flowchart of a first embodiment of the enhancement application method of the semantic parsing model of the application is shown. Figure 2 A flowchart of a second embodiment of the enhancement application method of the semantic parsing model of the application is shown. Figure 3 A flowchart of a third embodiment of the enhancement application method of the semantic parsing model of the application is shown. Figure 4 A flowchart of a fourth embodiment of the enhancement application method of the semantic parsing model of the application is shown. Figure 5 A flowchart of a fifth embodiment of the enhancement application method of the semantic parsing model of the application is shown. Figure 6 A module structure diagram of the enhancement application device of the semantic parsing model of the embodiment of the application is shown. Figure 7 A device structure diagram of the hardware running environment involved in the enhancement application method of the semantic parsing model in the embodiment of the application is shown.

[0017] The implementation, functional features and advantages of the application will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION

[0018] It should be understood that the specific embodiments described herein are only used to explain the application and not to limit the application.

[0019] The main technical scheme of the present application is: performing field semantic enhancement operation on a preset semantic parsing training set to generate a structured training sample containing example data; performing constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multi-constraint logic; inputting the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic parsing model; inputting a preset semantic parsing verification set into the semantic parsing model, filtering out a simplified table structure based on the semantic parsing verification set by the semantic parsing model, and generating a corresponding SQL query statement based on the simplified table structure.

[0020] The present application actually considers that due to the fuzziness of natural language expression, the complexity of database table structure and the diversity of user query intention, the existing model often faces problems such as semantic mapping deviation and table structure screening redundancy in actual application, resulting in deviation between the generated SQL query statement and the real demand of the user, especially in the scene containing multiple constraint conditions or complex table association, the accuracy is difficult to meet the actual demand.

[0021] Based on this, the present application proposes an enhanced application method of a semantic parsing model.

[0022] Specifically, the following are the detailed steps of the first embodiment of the enhanced application method of the semantic parsing model of the present application: Refer to Figure 1 , Figure 1 The flowchart of the first exemplary embodiment of the enhanced application method of the semantic parsing model of the present application. In this embodiment, the enhanced application method of the semantic parsing model includes steps S10-S40: Step S10, performing field semantic enhancement operation on a preset semantic parsing training set to generate a structured training sample containing example data; It should be noted that the present application uses a pre-constructed original data set, which is a data set specially designed for Chinese natural language to SQL conversion task. The original data set includes semantic parsing task, corresponding SQL statement, associated database identifier and database mode, wherein the database mode includes table name, column name, column type, table annotation, column annotation and other metadata. The present application divides the original data set into semantic parsing training set and semantic parsing verification set, wherein the semantic parsing training set is used for model training process, and the semantic parsing verification set is used for verification in the training process or performance evaluation and verification of the trained model.

[0023] The field semantic enhancement operation refers to injecting actual example data of a database field into a training sample to enhance the understanding ability of the model for the semantic of the field. The structured training sample refers to a structured data pair including a semantic parsing task, a corresponding SQL statement, a database schema, and field example data, and is used for model training, wherein the database schema includes table name, field name, and the like.

[0024] Based on this, a feasible implementation extracts the mapping relationship between a natural language query and a SQL statement from a preset semantic parsing training set, the natural language query being one of the semantic parsing tasks, and associates a corresponding database schema. For each field in the database schema, example data conforming to the data type of the field is generated by random sampling or rule generation, and the example data is embedded into the natural language query in the format of "field name: example value" to form a text after field semantic enhancement. Subsequently, the enhanced natural language query, the original SQL statement, the database schema, and the example data are integrated into a structured training sample containing multi-modal information, ensuring that the semantic of each field in the sample is explicitly expressed through the example data.

[0025] Step S20, performing constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multi-constraint logic; It should be noted that the constraint enhancement processing refers to diversifying and expanding the SQL constraint conditions in the training sample to increase the complexity of the logical relationship in the sample and improve the generalization ability of the model for the multi-constraint scene. The enhanced training sample set refers to a training sample set containing single constraint, combined constraint, nested constraint, and the like after the constraint enhancement processing.

[0026] A feasible implementation, based on the structured training sample, first parses the constraint conditions of the SQL statement in the structured training sample to identify the constraint type and the action field. Subsequently, the original constraint conditions are expanded by automatic rules, for example, for single constraint samples, multi-value constraints of the same field or logical combinations across fields are added; for samples containing multi-table association, the complexity of the table connection condition is increased. Finally, the expanded constraint conditions and the original sample are integrated to form an enhanced training sample set containing multi-constraint logic, ensuring that the sample covers diversified scenes from simple queries to complex nested queries.

[0027] Step S30, inputting the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic parsing model; It should be noted that the pre-trained language model fine-tuning refers to adjusting the parameters of the pre-trained language model using the enhanced training sample set to adapt the model to the specific task of natural language to SQL generation.

[0028] In an embodiment, a pre-trained language model with strong semantic understanding capability is selected as a base model, and training data is constructed based on an enhanced training sample set. Specifically, the natural language query in the enhanced training sample set is spliced with the database schema information to form the input sequence of the model; the SQL statement corresponding to the enhanced training sample set is taken as the target output sequence of the model, so as to construct the mapping relationship between the input and the output. In an embodiment, the fine-tuning process adopts a Seq2Seq (Sequence to Sequence) training framework, and the model parameters are optimized through a cross-entropy loss function. During training, a dynamic learning rate is set, and a gradient accumulation technique is used to solve the memory limitation problem. The semantic parsing verification set is used to monitor the SQL generation accuracy in real time, and after multiple rounds of iterative training, when the SQL accuracy on the semantic parsing verification set tends to be stable, the training is stopped, and a semantic parsing model adapted to the enhanced sample is obtained.

[0029] It should be noted that the semantic parsing verification set is used for monitoring performance and final verification. In the model training process, it is used for verification during training.

[0030] In step S40, the preset semantic parsing verification set is input into the semantic parsing model, and the semantic parsing model is used to filter out a simplified table structure based on the semantic parsing verification set, and generate a corresponding SQL query statement based on the simplified table structure.

[0031] At this time, the semantic parsing verification set is used for performance evaluation and verification of the trained model; the simplified table structure refers to a simplified structure obtained by filtering out tables and fields related to the query from the original database schema according to the user query intention and removing redundant information.

[0032] In an embodiment, the preset semantic parsing verification set is input into the semantic parsing model, and the semantic parsing verification set contains natural language queries and corresponding database schemas that are not involved in training. The model first performs intent recognition on the input natural language query, extracts the core query object, and calculates the semantic similarity between each table field and the query intention based on the table name, field name and example data in the database schema. Then, the tables and fields with a similarity higher than a threshold value are selected to construct a simplified table structure. Finally, the natural language query is converted into a SQL query statement based on the simplified table structure.

[0033] Further, with reference to Figure 2 , Figure 2 is a flowchart of the second embodiment of the application. In this embodiment, step S10 includes steps S11-S13: Step S11, extract the field name, corresponding database identifier and table name in the semantic parsing training set; Wherein, the field name is the name of the column in the database table, used to identify the data category stored in the table; the database identifier is an identifier used to uniquely distinguish different databases, ensuring that the field is associated with the correct data source. The table name is the name of the basic unit for storing structured data in the database, and each table contains multiple fields.

[0034] Specifically, the metadata information of the original sample is parsed from the semantic parsing training set, and the database identifier, table name and field name corresponding to each sample are extracted. Specifically, by parsing the database schema description file in the semantic parsing training set, the database identifier to which each SQL statement belongs is located, and the table name under the database is associated. Further, the table structure is traversed to extract all involved field names. During the extraction process, invalid characters are filtered through regular matching to ensure the integrity and accuracy of the field name, database identifier and table name, and the extraction results are stored in the format of triplets.

[0035] Step S12, based on the field name, database identifier and table name, associate to a preset structured database, and extract the actual data corresponding to the field name from the structured database as example data; Wherein, the preset structured database refers to a database cluster containing real business data constructed in advance, which stores the actual business records corresponding to the field of the semantic parsing training set. The example data is the real data value extracted from the structured database corresponding to the field name, which is used to enhance the concrete expression of the field semantics. For example, the example data of the "age" field can be "25".

[0036] Based on the extracted triplets, the target database in the preset structured database cluster is located through the database identifier, and the specific data table is determined according to the table name. For the field name in the target table, the actual data is extracted from the table as example data by using random stratified sampling, for example, for numerical fields, 20% to 80% of the random samples covering the field value range are extracted; for string type fields, samples containing common prefixes, suffixes or special characters are extracted; for enumeration type fields, all enumeration values are extracted. After the example data is extracted, de-duplication and desensitization processing is performed to ensure data privacy and security, and finally a "field name-example data" mapping table is formed.

[0037] Step S13, associate the example data with the field name to form a structured training sample containing the corresponding relationship between the field name and the example data.

[0038] Specifically, the generated "field name-exemplary data" mapping table is associated and fused with the original samples in the semantic parsing training set to form structured training samples. Specifically, in the database schema part of the original sample, the corresponding exemplary data annotation is added for each field name, and the format is like "field name (example: value 1, value 2, value 3)", "age (example: 25, 30, 35)", "gender (example: male, female)"; At the same time, in the natural language query text, the field semantic prompt is supplemented by the way of context embedding, for example, "query the user whose age is greater than 20" is optimized to "query the user whose age field (example value: 25, 30) is greater than 20". Finally, the associated natural language query, the corresponding SQL statement, and the database schema information with exemplary data are integrated into a structured training sample in JSON format, ensuring that the correspondence between the field name and the exemplary data is explicitly presented in the sample.

[0039] Exemplarily, taking the semantic parsing training of an e-commerce platform user behavior analysis scene as an example: first, parse the metadata information from the original sample of the semantic parsing training set, assuming that the database identifier corresponding to the original sample is “db_shop”, and by parsing the Schema description file of the database, the user information table with the table name “user_info” is located, the field names “user_id”, “age”, “gender”, “registration_time” involved are extracted after traversing the table structure, and the invalid characters such as underscores and spaces in the field names are filtered out through regular matching, and finally the structured data such as triplets (age, db_shop, user_info), (gender, db_shop, user_info) is formed. Subsequently, based on the above triplets, the preset structured database cluster is accessed through the database identifier “db_shop”, and the “user_info” table is located. For the “age” field, random stratified sampling is adopted to extract four example data of 25, 30, 35 and 40 from the value range of 18-60 years old; for the “gender” field, all enumerated values “male”, “female” and “unknown” are extracted; for the “registration_time” field, samples containing different quarters “2023-03-15” and “2023-07-22” are extracted, and the example data of the “user_id” field is desensitized. Finally, a “field name-example data” mapping table is generated. Further, the mapping table is fused with the original sample, and the database mode part is labeled as “age (example: 25, 30, 35, 40)” and “gender (example: male, female, unknown)”. At the same time, the natural language query “query adult users registered in 2023” is optimized to “query registration_time field (example: 2023-03-15, 2023-07-22) in 2023 and age field (example: 25, 30) greater than 18 users”, and the associated natural language query, original SQL statement and database mode information with example data are integrated into a structured training sample in JSON format, wherein the “schema” field contains “table_name: user_info”, “columns: [{'name': 'age', 'examples': [25,30,35,40]},...]” and other key-value pairs, realizing the explicit association of field semantics and data features.

[0040] Further, referring to Figure 3 , Figure 3 is a flowchart of the third embodiment of the application. In this embodiment, the step S20 includes steps S21-S22: Step S21, based on the preset constraint rule library, the SQL query statement of each training sample in the structured training sample is analyzed for constraint requirement characteristics; Wherein, the constraint rule library refers to the pre-constructed structured rule set, which contains the constraint type, constraint condition template and trigger condition in the SQL query; the constraint requirement characteristic analysis refers to identifying the constraint logic requirement implied in the SQL query statement and the corresponding natural language query in the structured training sample through syntax analysis and semantic understanding, including constraint type, constraint object and constraint relationship.

[0041] A feasible implementation, based on the preset constraint rule library, constraint requirement characteristic analysis is performed on each sample in the structured training sample. Specifically, the original SQL query statement in the sample is parsed by the SQL syntax parser, the WHERE clause, HAVING clause and ON clause are traversed, all existing constraint conditions are extracted, and are classified and labeled according to constraint type and constraint field to form an "existing constraint list". At the same time, the semantic role labeling and keyword extraction are performed on the natural language query text corresponding to the sample: the constraint requirement trigger words (such as "at least", "exclude", "must") in the text are identified using the BERT model, the constraint object and the constraint relationship description (such as "greater than", "not equal to"), and the trigger word-constraint type mapping table (such as "at least" mapping "> comparison constraint") in the constraint rule library is combined to generate an "implicit constraint requirement list".

[0042] Subsequently, the "existing constraint list" and the "implicit constraint requirement list" are cross-verified: if the implicit constraint requirement in the natural language query does not exist in the SQL existing constraint, the sample is marked as "to be supplemented constraint"; if there is a constraint condition in the SQL that is not mentioned in the natural language, whether it is marked as "suspected over-constraint" is judged by the business necessity rule in the rule library. Finally, the existing constraint type, implicit constraint requirement, constraint conflict risk and other characteristics of each sample are integrated into a feature vector, each dimension in the vector corresponds to the presence or absence or strength of a constraint characteristic, providing a standardized input for subsequent constraint matching.

[0043] Step S22, according to the analysis result, the corresponding query constraint condition is automatically matched from the constraint rule library, and the query constraint condition is added to the SQL query statement of the training sample to generate an enhanced training sample set containing multiple constraint logics.

[0044] Among them, the query constraint condition refers to the structured constraint unit matched from the constraint rule library and directly added to the SQL statement, which is composed of constraint operators (such as >, <, IN, NOT EXISTS), constraint fields (such as "age", "user_type"), threshold or reference values (such as "18", "'test'") and logical connectors (such as "AND", "OR"), and is used to supplement or strengthen the query logic of SQL.

[0045] Specifically, a matching mechanism based on a rule engine is adopted: for the requirements marked as "to be supplemented constraints" in the feature vector, the pre-defined constraint templates are recalled from the constraint rule library according to the trigger word and the constraint object, and specific threshold values are filled in; for the "suspected over-constrained" features, the business necessity label in the constraint rule library is queried to automatically delete the redundant conditions. After the matching is completed, the query constraint condition is inserted into the corresponding position of the SQL statement according to the constraint priority: the sibling constraints are added to the end of the WHERE clause through the "AND" / "OR" connector; the nested constraints are adjusted in the logical level through the brackets to generate the clause structure of "(rank<10 OR score>90)". For the SQL statement containing the JOIN operation, it is necessary to additionally check whether the table to which the constraint field belongs has been declared in the FROM or JOIN clause to avoid syntax errors caused by the absence of table association. After all the query constraint conditions are added, the statement legality is checked by the SQL syntax checker, and the invalid samples are filtered by the logical consistency detector. Finally, the original structured training samples and the newly added enhanced samples are mixed in a predetermined proportion to form an enhanced training sample set containing multiple constraint logic, wherein each sample contains "original SQL", "enhanced SQL", "constraint addition record" and "constraint type label", providing rich constraint logic training data for the semantic parsing model.

[0046] Exemplarily, based on the preset constraint rule library, the constraint requirement feature analysis is performed on the original SQL query statement "SELECT order_id FROM orders WHERE user_id = 'U12345' AND order_time>'2023-01-01'" in the structured training sample. First, the SQL is parsed by the SQL syntax parser to extract the existing constraint conditions "user_id = 'U12345'" (equality constraint) and "order_time>'2023-01-01'" (comparison constraint), forming an "existing constraint list"; Meanwhile, the semantic role labeling is performed on the corresponding natural language query "query the orders of user U12345 after 2023, excluding test orders", and the trigger word "exclude" and the constraint object "test orders" are extracted, and the "implicit constraint requirement list" is generated in combination with the constraint rule library.

[0047] Cross-validation found that the "exclude test order" in natural language was not reflected in SQL, so it was marked as "to be supplemented constraint", and the existing constraint type, implicit demand and other features were integrated into the feature vector.

[0048] Subsequently, based on the feature vector, the constraint condition is matched from the constraint rule library: according to the trigger word "exclude" and the constraint object "test order", the template "order_type NOT IN ('test', 'demo')" is called, and the threshold values "'test'", "'demo'" are filled; At the same time, check if there is "suspected over-constraint" in SQL. Then add the new condition to the end of the WHERE clause according to the constraint priority, generate enhanced SQL "SELECT order_id FROM orders WHERE user_id = 'U12345' AND order_time>'2023-01-01' AND order_type NOT IN ('test', 'demo')", After the SQL syntax checker confirms the legality, it is mixed with the original sample in a ratio of 1:4 to form an enhanced training sample set containing the original SQL, enhanced SQL and constraint records.

[0049] Further, in the fourth embodiment of the enhanced application method of the semantic analysis model of the present application, the enhanced training sample set includes a first semantic analysis task, and the step of inputting the enhanced training sample set into the pre-trained language model for fine-tuning to obtain a semantic analysis model includes step S31: Step S31, based on the first semantic analysis task, add a preset number of trainable parameters in the attention module of the pre-trained language model, fix the original parameters of the pre-trained language model, adjust the newly added trainable parameters using the enhanced training sample set, and generate a semantic analysis model adapted to the first semantic analysis task.

[0050] The first semantic analysis task refers to a semantic analysis task in the target scene in the application, specifically converting a natural language query into an SQL query statement that meets the preset constraint rules; the attention module refers to a core component of a Transformer encoder in a pre-trained language model, which aggregates context information by calculating attention weights between tokens in an input sequence, and includes three linear transformation matrices of query, key, and value, and a multi-head attention mechanism; the trainable parameters refer to newly added weight parameters that allow updating through backpropagation in the model fine-tuning stage, specifically the weight matrix and bias vector of the "constraint feature adaptation layer" in the attention module in the embodiment, which is used to capture specific patterns of SQL constraint logic; the original parameters refer to weight parameters that have been learned by the pre-trained language model in the pre-training stage, which are kept fixed by freezing in this step to avoid overfitting caused by small sample fine-tuning.

[0051] A feasible implementation process is as follows: To adapt the pre-trained language model to the first semantic analysis task, a batch of task-specific trainable parameters is added to the original attention module of the pre-trained language model. In practice, a new parameter matrix is added to each attention head used to capture the association between words when the pre-trained language model processes text. The parameter matrix is used to convert the original general attention features of the model into features that focus more on semantic analysis tasks. At the same time, all the original basic parameters of the pre-trained model are frozen through technical means to ensure that these parameters are not modified in subsequent training, thereby preserving the existing general language understanding capabilities of the model. For example, after loading the pre-trained language model, the gradient calculation function of the original parameters of the model is turned off through code instructions. In this way, when calculating the prediction error in the subsequent backpropagation, these parameters will not receive gradient update signals, and their values will remain the same as in the pre-training stage throughout the fine-tuning process, thereby achieving parameter freezing.

[0052] Subsequently, the enhanced training sample set is input into the pre-trained language model in batches, and the enhanced training sample set contains samples of original SQL, enhanced SQL, and constraint labels. The pre-trained language model first processes the input natural language query using the frozen basic parameters, then performs task adaptation calculation using the newly added trainable parameters, and finally generates a predicted SQL statement. The predicted result is compared with the enhanced SQL in the enhanced training sample, the difference between the two is calculated, and the newly added trainable parameters are adjusted according to the error size, for example, if the model misses the constraint condition for excluding test orders, the sensitivity of the word "exclude" is strengthened through error feedback.

[0053] During the training process, the performance of the model on the validation set is continuously monitored, which can be a preset semantic parsing validation set. When the accuracy of the model on the validation set no longer improves after continuous training for multiple rounds, it indicates that the model has fully learned the task characteristics, and further training may cause overfitting. Therefore, the training is automatically stopped, and the current trainable parameters are saved. The final semantic parsing model not only retains the general language understanding ability of the pre-trained model, but also masters the constraint logic processing ability specific to the semantic parsing task through the newly added parameters.

[0054] Based on this, referring to Figure 4 In the fourth embodiment of the present application, the step of inputting the enhanced training sample set into the pre-trained language model for fine-tuning further includes steps S311-S313: Step S311, using a distributed computing architecture, distributing the enhanced training sample set and the model parameters of the pre-trained language model to multiple computing nodes; Wherein, the distributed computing architecture refers to a hardware and software cooperative framework that decomposes the training task into multiple sub-tasks and executes them in parallel through multiple computing nodes, including data parallelism and model parallelism; the computing node refers to an independent computing unit participating in distributed training, each node is equipped with an independent processor, memory and network interface, and can independently execute part of the training task and communicate with other nodes.

[0055] The distributed computing architecture is used to distribute the enhanced training sample set and the model parameters of the pre-trained language model. Specifically, according to the number of enhanced training samples and the storage capacity of the computing nodes, the enhanced training sample set is evenly distributed to multiple computing nodes using a sample ID hash slicing strategy, and each computing node only stores part of the sample data, while maintaining the global consistency of the sample index through a distributed file system.

[0056] For model parameters, the parameter server architecture is used to copy the original parameters of the pre-trained language model to the local memory of each computing node, ensuring that the original parameters do not need to be read across nodes during forward propagation; the newly added trainable parameters are stored in the parameter server and are sliced by parameter dimension, with each slice managed by a parameter server node. In addition, the communication protocol between nodes is configured, and the connection between nodes is initialized through a distributed training framework to ensure that the sample slicing and parameter slicing processes are traceable.

[0057] The original parameters of the pre-trained language model are copied to the local memory of each computing node to ensure that the original parameters do not need to be read across nodes during forward propagation; the newly added trainable parameters are stored in the parameter server and are sliced by parameter dimension.

[0058] Through the distributed deployment of samples and parameters, efficient utilization of training data and computing resources is achieved, avoiding the problem of excessive storage pressure on a single node, and reducing cross-node communication overhead by loading original parameters in local memory.

[0059] In step S312, for the training process of the added trainable parameter, the training effect of different combinations of learning rate and weight decay coefficient is iteratively tested to determine the optimal combination of hyperparameters that adapt the added trainable parameter to the first semantic parsing task. The combination of hyperparameters refers to the combination of parameters that need to be set in advance in the model training process, including learning rate, weight decay coefficient, etc.

[0060] For the training process of the added trainable parameter, an iterative test scheme of hyperparameter combination is designed. Specifically, according to the characteristics of the first semantic parsing task, such as the complexity of the constraints in the sample, candidate value ranges are selected from the hyperparameter space: the learning rate covers the logarithmic distribution interval from the minimum value to the medium value, and the weight decay coefficient covers the linear distribution interval from the near-zero value to the medium value. Subsequently, the grid search method is used to generate hyperparameter combinations, and each combination corresponds to an independent training experiment. In the iterative test, the same subset of augmented training samples and fixed training rounds are used in each experiment, and multiple experiments are performed in parallel through the distributed computing architecture. During the experiment, the average loss value and the SQL logical accuracy of the validation set, such as the matching degree of the generated constraint conditions and the true labels, are recorded in real time, and a hyperparameter heat map is drawn: the horizontal axis is the learning rate, the vertical axis is the weight decay coefficient, and the color represents the accuracy. According to the peak area in the heat map, the optimal combination of hyperparameters that adapt the added trainable parameter to the first semantic parsing task is determined.

[0061] In step S313, based on the distributed computing architecture and the optimal combination of hyperparameters, the training adjustment of the added trainable parameter is performed.

[0062] Based on the distributed computing architecture and the optimal combination of hyperparameters, systematic training adjustment is performed on the added trainable parameter. Specifically, the optimal combination of hyperparameters is synchronized to all computing nodes and parameter servers to ensure that each node uses consistent training configuration. After the training starts, each computing node loads the locally allocated augmented training sample batch, performs forward propagation through the original parameters of the pre-trained language model to generate intermediate feature vectors, and then inputs the intermediate feature vectors into the added trainable parameter to calculate the final prediction output. According to the difference between the prediction output and the true label of the sample, the local loss value is calculated, and the gradient is back-propagated to the added trainable parameter through the chain rule.

[0063] After each computing node independently calculates the gradient, it is immediately uploaded to the parameter server and updates the corresponding shard of the trainable parameters, without waiting for other nodes to complete gradient calculation, while avoiding gradient anomalies by limiting the gradient norm within a predetermined threshold. After completing a predetermined number of batch training, the parameter server triggers global verification: using the semantic parsing verification set as the verification set, all computing nodes calculate the average loss value and logical accuracy of the model on the verification set in parallel, and if the performance of the verification set does not improve for several consecutive times, the training is automatically terminated and the current trainable parameter weight value is saved. Finally, the trained trainable parameters are integrated with the original parameters of the pre-trained language model to form a complete semantic parsing model that can efficiently handle semantic parsing tasks involving multiple constraint logics.

[0064] Further, with reference to Figure 5 , Figure 5 is a flowchart of the fifth embodiment of the application, which is an enhanced application method of the semantic parsing model. In this embodiment, the semantic parsing verification set includes a second semantic parsing task, and the step of filtering out a simplified table structure based on the semantic parsing verification set by the semantic parsing model includes step S41: Step S41: evaluating the relevance of each table and field in the database associated with the semantic parsing verification set to the semantic parsing task by the semantic parsing model, and based on the evaluation results, filtering out the table structure related to the second semantic parsing task from the semantic parsing verification set to form the simplified table structure.

[0065] wherein the second semantic parsing task refers to a target semantic parsing task for verifying the generalization ability of the model, which belongs to the same type as the first semantic parsing task but has different specific scenarios or fields, and its input is a natural language query and its output is a structured query statement.

[0066] In an embodiment, the semantic parsing model evaluates the relevance of each table and field in the database associated with the semantic parsing verification set to the second semantic parsing task, and filters the simplified table structure based on the evaluation results. Specifically, the semantic parsing model performs intent recognition on the natural language query of the second semantic parsing task, extracts core entities and operation types, and determines the core topic involved in the task. Subsequently, the semantic parsing model traverses all table structures in the database associated with the semantic parsing verification set, evaluates the relevance of each table and field to the task by calculating the semantic similarity between the table name, field name and the core entity of the task, for example, if the core entity of the task is "logistics order number", the semantic similarity between the "tracking_id" field of the "logistics table" in the database and the task is higher than that between the "user_name" field of the "user table" and the task. At the same time, the semantic parsing model combines the historical query records of the second semantic parsing task to count the frequency of each table and field in the relevant queries as an auxiliary index for relevance evaluation. Finally, the tables and fields with a semantic similarity higher than a preset threshold and a frequency exceeding a set proportion are retained, and irrelevant tables and redundant fields are removed, forming a simplified table structure containing only core tables and key fields, which ensures that the structure can cover all query requirements of the second semantic parsing task and avoid interference of irrelevant information on the model generation logic.

[0067] In the fifth embodiment of the present application, the step of generating a corresponding SQL query statement based on the simplified table structure includes step S42: Step S42, mapping the task intent of the second semantic parsing task to the simplified table structure through the semantic parsing model to generate a query statement conforming to the SQL standard.

[0068] Wherein, the task intent refers to the user goal implied by the natural language query in the second semantic parsing task, including query objects, constraint conditions and operation types, etc. The SQL standard refers to the structured query language specification formulated by ISO, including data query, condition filtering, grouping and aggregation, etc.

[0069] In an implementable embodiment, the task intent of the second semantic parsing task is mapped to a simplified table structure by a semantic parsing model to generate a query statement conforming to the SQL standard. Specifically, the natural language query of the second semantic parsing task is structurally parsed by the semantic parsing model, the entities, attributes, and constraint conditions in the task intent are extracted using named entity recognition technology, and the logical relationship between the entities is determined through dependency syntax analysis. Subsequently, the semantic parsing model establishes a mapping relationship between the task intent and the table structure based on the table name and field name in the simplified table structure. For example, if the entity in the task intent is "logistics order number LP123456", the attribute is "delivery status", the constraint condition is "unreceived", and the logical relationship between the entities is that "LP123456" is the query object of "delivery status", the mapping process is to map "delivery status" to the "status" field of the "logistics table" in the simplified table structure, and map "unreceived" to the enumeration value "unreceived" of the field.

[0070] Further, according to the operation type of the task intent, the semantic parsing model selects a corresponding SQL syntax template, fills the mapped field name, entity value, and constraint condition into the template, and finally checks the grammatical correctness of the generated statement through a built-in SQL syntax checking module to ensure that the generated query statement conforms to the SQL standard and can be accurately executed in the database corresponding to the simplified table structure. Finally, a directly executable SQL query statement is output.

[0071] In addition, with reference to Figure 6 The application also provides an enhanced application device of a semantic parsing model, which comprises: A first preprocessing module 10 is configured to perform a field semantic enhancement operation on a preset semantic parsing training set to generate a structured training sample containing example data; A second preprocessing module 20 is configured to perform constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multiple constraint logics; A model training module 30 is configured to input the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic parsing model; A verification generation module 40 is configured to input a preset semantic parsing verification set into the semantic parsing model to filter out a simplified table structure based on the semantic parsing verification set by the semantic parsing model, and generate a corresponding SQL query statement based on the simplified table structure.

[0072] The semantic parsing model enhancement application device provided in the application adopts the semantic parsing model enhancement application method in the above embodiment, and aims to solve the technical problem of low accuracy of generated SQL query statements in the process of converting natural language queries into SQL queries by using the existing semantic parsing model. Compared with the prior art, the semantic parsing model enhancement application device provided in the application has the same beneficial effects as the semantic parsing model enhancement application method provided in the above embodiment, and other technical features in the semantic parsing model enhancement application device are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0073] The application provides a semantic parsing model enhancement application device, which comprises at least one processor and a memory in communication connection with the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the semantic parsing model enhancement application method in the above embodiment one.

[0074] The semantic parsing model enhancement application device in the embodiment of the application can include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistant), PADs (Portable Application Description), PMPs (Portable Media Player), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. Figure 7 The illustrated semantic parsing model enhancement application device is only an example, and should not bring any limitation to the function and use range of the embodiment of the application.

[0075] As Figure 7As shown, the semantic parsing model enhanced application device can include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to programs stored in a read-only memory 1002 or loaded from a storage device 1003 into a random access memory 1004. Various programs and data required for the operation of the semantic parsing model enhanced application device are also stored in the random access memory 1004. The processing device 1001, the read-only memory 1002, and the random access memory 1004 are connected to each other by a bus 1005. An input / output interface 1006 is also connected to the bus. Generally, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; the storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the semantic parsing model enhanced application device to communicate with other devices wirelessly or by wire to exchange data. Although the semantic parsing model enhanced application device with various systems is shown in the figure, it should be understood that all the systems shown are not required to be implemented or possessed. More or fewer systems can be alternatively implemented or possessed.

[0076] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program codes for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network through the communication device, or installed from the storage device 1003, or installed from the read-only memory 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the methods of the embodiments disclosed in the present application are performed.

[0077] The semantic parsing model enhanced application device provided by the present application adopts the semantic parsing model enhanced application method in the above embodiments, and aims to solve the technical problem of low accuracy of generating SQL query statements in the process of converting natural language queries into SQL queries by the existing semantic parsing model. Compared with the prior art, the semantic parsing model enhanced application device provided by the present application has the same beneficial effects as the semantic parsing model enhanced application method provided by the above embodiments, and other technical features in the semantic parsing model enhanced application device are the same as the features disclosed in the previous embodiment method, which will not be repeated here.

[0078] It should be understood that various aspects of the disclosure can be implemented in hardware, software, firmware, or a combination thereof. In the description of the embodiments above, specific features, structures, materials or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0079] The above description is merely illustrative of the application and is not intended to limit the scope of the application. Any variations and modifications that can be made by any person skilled in the art within the spirit and scope of the application are intended to be encompassed by the application. The scope of the application is defined by the appended claims.

[0080] The application provides a computer readable storage medium having stored thereon computer readable program instructions (i.e., a computer program) for performing the enhanced application method of the semantic parsing model in the above-described embodiments.

[0081] The computer readable storage medium provided by the application may, for example, be a U disk, but is not limited to an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system or device, or any combination thereof. More specific examples of the computer readable storage medium can include, but are not limited to, an electric connection having one or more conductive wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present embodiment, the computer readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to an electric wire, an optical cable, an RF (Radio Frequency), etc., or any suitable combination thereof.

[0082] The above-described computer readable storage medium can be included in the enhanced application device of the semantic parsing model, or can exist separately without being assembled into the enhanced application device of the semantic parsing model.

[0083] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).

[0084] The flow diagrams and the block diagrams in the drawings are meant as methodological and functional description of implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flow diagrams or block diagrams can represent a module, a segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or in the reverse order, depending on the functionality involved. It will also be noted that each block in the block diagrams and / or flow diagrams, and combinations of blocks in the block diagrams and / or flow diagrams, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.

[0085] The modules involved in the embodiments of the present application can be implemented by software or by hardware. In some cases, the name of the module does not constitute a limitation on the module itself.

[0086] The readable storage medium provided by the present application is a computer readable storage medium, which stores computer readable program instructions (i.e. computer programs) for executing the enhanced application method of the semantic parsing model. The technical problem of low accuracy of generating SQL query statements in the process of converting natural language queries into SQL queries by the existing semantic parsing model is solved. Compared with the prior art, the beneficial effects of the computer readable storage medium provided by the present application are the same as those of the enhanced application method of the semantic parsing model provided by the above-mentioned embodiments, which are not described here.

[0087] The application also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the enhanced application method of the semantic parsing model as described above.

[0088] The computer program product provided by the application aims to solve the technical problem of low accuracy of generated SQL query statements in the process of converting natural language queries into SQL queries by using the existing semantic parsing model. Compared with the prior art, the beneficial effects of the computer program product provided by the application are the same as those of the enhanced application method of the semantic parsing model provided by the above-mentioned embodiments, which will not be repeated here.

[0089] Compared with the prior art, the enhanced application method, device, equipment, medium and computer product of the semantic parsing model provided by the embodiments of the application extract the business feature information of the target business, perform data standardization processing on the business feature information to obtain standard feature data, perform hash processing on the standard feature data to obtain unique feature data, perform numerical processing and splicing processing on the unique feature data to obtain a first business feature value, accumulate the first business feature value of the target business to obtain a target business feature value, and finally compare the target business feature value with a feature value set to obtain an enhanced application result of the semantic parsing model. Compared with the traditional method of generating a unique key value or a continuous serial number for each business to identify repeated businesses, the method is more efficient, flexible and reliable. Based on the scheme of the application, the business in a complex scenario is finally converted into a comparison of two numbers through a series of simple transformations, so that the comparison process is very intuitive and efficient. The system only needs to simply compare whether the two values are equal, and can quickly determine whether the two businesses are exactly the same.

[0090] It should be noted that in this document, the terms "comprise", "comprise", or any other variant thereof are intended to cover non-exclusive inclusion, so that processes, methods, articles or systems including a series of elements not only include those elements, but also include other elements not explicitly listed, or include elements inherent to such processes, methods, articles or systems. Without more limitations, the element defined by the statement "comprises a" does not exclude the presence of additional identical elements in the process, method, article or system comprising the element.

[0091] The above-mentioned serial numbers of the embodiments of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0092] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and the necessary general hardware platform, of course, can also be through hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application essentially or say the part of the prior art contribution can be embodied in the form of software products, the computer software product is stored in the above-mentioned storage medium (such as ROM / RAM, magnetic disc, optical disc), including a number of instructions to make a terminal device (may be a mobile phone, computer, server, controlled terminal, or network equipment, etc.) executes the method of each embodiment of the present application.

[0093] The above is only the preferred embodiment of the present application, not therefore limit the patent scope of the present application, any equivalent structure or equivalent process transformation using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. An enhanced application method of a semantic parsing model, characterized in that, The enhanced application method of the semantic parsing model comprises: Performing field semantic enhancement operation on the preset semantic parsing training set to generate a structured training sample containing example data; Performing constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multi-constraint logic; Inputting the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic parsing model; Inputting a preset semantic parsing verification set into the semantic parsing model to filter out a simplified table structure based on the semantic parsing verification set through the semantic parsing model, and generating a corresponding SQL query statement based on the simplified table structure.

2. The method of claim 1, wherein the semantic parsing model is enhanced by, The step of performing field semantic enhancement operation on the preset semantic parsing training set to generate a structured training sample containing example data comprises: Extracting field names, corresponding database identifiers and table names in the semantic parsing training set; Based on the field names, database identifiers and table names, associating to a preset structured database, and extracting actual data corresponding to the field names from the structured database as example data; Associating the example data with the field names to form a structured training sample containing the correspondence between the field names and the example data.

3. The method of claim 1, wherein the semantic parsing model is enhanced by, The step of performing constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multi-constraint logic comprises: Based on a preset constraint rule library, performing constraint requirement feature analysis on the SQL query statement of each training sample in the structured training sample; According to the analysis result, automatically matching the corresponding query constraint condition from the constraint rule library, and adding the query constraint condition to the SQL query statement of the training sample to generate an enhanced training sample set containing multi-constraint logic.

4. The method of claim 1, wherein the semantic parsing model is enhanced by, The enhanced training sample set includes a first semantic parsing task, and the step of inputting the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic parsing model comprises: Based on the first semantic parsing task, adding a preset number of trainable parameters to the attention module of the pre-trained language model, fixing the original parameters of the pre-trained language model, adjusting the added trainable parameters using the enhanced training sample set, and generating a semantic parsing model adapted to the first semantic parsing task.

5. The method of claim 4, wherein the semantic parsing model is enhanced by, The step of inputting the enhanced training sample set into a pre-trained language model for fine-tuning further comprises: Using a distributed computing architecture, distributing the enhanced training sample set and the model parameters of the pre-trained language model to multiple computing nodes; For the training process of the added trainable parameters, determine the optimal hyperparameter combination that makes the added trainable parameters adapt to the first semantic parsing task by iteratively testing the training effect of different combinations of learning rate and weight decay coefficient values; Based on the distributed computing architecture and the optimal hyperparameter combination, performing training adjustment on the added trainable parameters.

6. The method of claim 1, wherein the semantic parsing model is enhanced by, The semantic parsing verification set includes a second semantic parsing task, and the step of filtering out a simplified table structure based on the semantic parsing verification set through the semantic parsing model comprises: The semantic analysis model is used to evaluate the relevance of each table and field in the database associated with the semantic analysis verification set to the semantic analysis task, and based on the evaluation result, a table structure related to the second semantic analysis task is selected from the semantic analysis verification set to form the simplified table structure.

7. The method of claim 6, wherein the semantic parsing model is enhanced by, The step of generating a corresponding SQL query statement based on the simplified table structure comprises: The semantic analysis model is used to map the task intention of the second semantic analysis task to the simplified table structure to generate a query statement conforming to the SQL standard.

8. An enhanced application apparatus of a semantic parsing model, characterized by, The device comprises: A first preprocessing module is configured to perform a field semantic enhancement operation on a preset semantic analysis training set to generate a structured training sample containing example data. A second preprocessing module is configured to perform constraint enhancement processing on the structured training sample to generate an enhanced training sample set containing multi-constraint logic. A model training module is configured to input the enhanced training sample set into a pre-trained language model for fine-tuning to obtain a semantic analysis model. A verification generation module is configured to input a preset semantic analysis verification set into the semantic analysis model, filter a simplified table structure based on the semantic analysis verification set by using the semantic analysis model, and generate a corresponding SQL query statement based on the simplified table structure.

9. An enhanced application device of a semantic parsing model, characterized by, The device comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, and the computer program is configured to implement the steps of the enhanced application method of the semantic analysis model according to any one of claims 1 to 7.

10. A storage medium, characterized by The storage medium is a computer-readable storage medium, and the storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the enhanced application method of the semantic analysis model according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Power data enhancement analysis method for enabling Text2SQL (Structured Query Language) based on large language model

    CN118964410A

  • Method and device for generating SQL (Structured Query Language) based on semantic alignment and hierarchical Agent

    CN119377255A

  • Intelligent data analysis method and system based on semantic interaction

    CN120011572A

  • Text-to-SQL (Structured Query Language) complex query statement generation method and system based on pre-training large model

    CN120492458A

  • Automatic NL2SQL data set construction method and system based on large language model

    CN120631915A