Power audit SQL statement generation method based on large model

By performing normative verification and identity identification on the input data, combining RAG technology and text degree model, power audit SQL statements are generated, which solves the problem of erroneous SQL statements in the existing technology that format is not standardized text data generation, and improves the efficiency and accuracy of SQL statement generation.

CN119621751APending Publication Date: 2025-03-14国网安徽省电力有限公司综合服务中心 +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411705572.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

When the prior art directly generates text data to SQL statements, text data with irregular formats are prone to generate incorrect SQL statements, resulting in low power audit work efficiency.

Method used

By obtaining the input data, it is determined whether its normative coefficient is greater than the threshold. If so, input data to the SQL generation model to generate SQL statements; otherwise, generate a prompt signal and re-enter the data. This method combines identity recognition model, text degree model and RAG technology to ensure data normativeness before generating SQL statements.

Benefits of technology

Reduce the generation of wrong SQL statements due to irregular information, improve the efficiency and accuracy of SQL statement generation, and improve the efficiency of power audit work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621751A_ABST
    Figure CN119621751A_ABST
Patent Text Reader

Abstract

The invention discloses an electric power auditing SQL statement generation method based on a large model, relates to the technical field of information, and solves the technical problem that in the prior art, text data is directly generated into SQL statements, so that some text data with irregular formats are generated into wrong SQL statements, and the efficiency of electric power auditing work is low. The method comprises the following steps: identifying and verifying input data; calculating a data normativity coefficient according to the input data; when the data normativity coefficient is greater than a normativity coefficient threshold value, inputting the input data into an SQL generation model to obtain an SQL statement; otherwise, generating a prompt signal, re-inputting the data, interacting through diversified data, and carrying out standardized verification on the input data before generating the SQL statement, so that the statement generation times of nonstandard information are reduced, and meanwhile, fine adjustment is carried out on the large model in the field of electric power auditing, so that the generation accuracy of the SQL statement is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of information technology, and specifically is a method for generating SQL statements for power auditing based on a large model. Background Art

[0002] Power audit refers to the audit of power companies' electricity revenue, electricity price policies, costs and expenses, accounting and management transactions, and whether there is fraud and other behaviors. It is an important part of internal management and supervision in the power industry, aiming to ensure that power companies operate in compliance and efficiency and maintain fair competition in the power market. A large model refers to an artificial intelligence model built by a deep neural network containing more than tens of billions of parameters. It has billions or even hundreds of billions of parameters and can handle more complex tasks and data. Its application areas are wide and deep, covering natural language processing, computer vision, bioinformatics, autonomous driving, finance and other key fields.

[0003] In the traditional power audit process, SQL statements need to be manually written to query and analyze power data, which is not only time-consuming and labor-intensive, but also has low accuracy. With the development of big data and artificial intelligence technology, there are also methods of generating SQL statements using large models. However, there is a problem of directly generating SQL statements for text data, which causes some text data with irregular formats to generate incorrect SQL statements, resulting in low efficiency of power audit work. Therefore, the method of generating SQL statements for power audit still needs further improvement. Summary of the invention

[0004] The present application aims to solve at least one of the technical problems existing in the prior art; to this end, the present application proposes a method for generating SQL statements for power auditing based on a large model, which is used to solve the technical problem that the prior art directly generates SQL statements from text data, causing some text data with irregular formats to generate erroneous SQL statements, resulting in low efficiency of power auditing work.

[0005] To achieve the above objectives, the first aspect of the present application provides a method for generating SQL statements for power audit based on a large model, comprising:

[0006] S0: Obtain input data; the input data includes voice data or text data; the voice data includes voiceprint information and content information; determine whether the input data is voice data; if yes, enter S1; if no, enter S2;

[0007] S1: Obtain an identity tag from the voice data through an identity recognition model, wherein the identity recognition model is constructed through an artificial intelligence model; determine whether the identity tag is a staff member; if yes, proceed to S2; if no, generate a no-authorization prompt signal and end the operation;

[0008] S2: Calculate the data standardization coefficient based on the input data; determine whether the data standardization coefficient is greater than the standardization coefficient threshold; if yes, proceed to S3; if no, generate a data non-standardization prompt signal and remind the user to re-enter the data, and proceed to S0;

[0009] S3: Inputting the input data into the SQL generation model to obtain an SQL statement; the SQL generation model is obtained by combining the RAG technology with the large model.

[0010] This application calculates the data normalization coefficient according to the input data in the above steps, and performs normalization verification on the input data before generating SQL statements, thereby reducing the generation of erroneous SQL statements due to non-standard information, improving the efficiency of SQL statement generation and the user experience.

[0011] Furthermore, the identity recognition model is constructed through an artificial intelligence model, including:

[0012] Obtain historical voiceprint information and its corresponding identity tag;

[0013] Divide historical voiceprint information into training data, verification data, and test data according to identity labels; perform voiceprint preprocessing on the training data, verification data, and test data to obtain a training set, a verification set, and a test set;

[0014] Select an AI model as the base model;

[0015] Train the basic model with the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model;

[0016] By verifying the pre-trained model on the test set, we finally get the identity recognition model which inputs voiceprint information and outputs identity labels.

[0017] Further, the calculating of the data standardization coefficient according to the input data includes:

[0018] Get input data;

[0019] Generate grammatical correctness level YZD, expression clarity level BQD and domain relevance level LXD according to input data;

[0020] The data normalization coefficient is calculated by the formula SGX=α1×YZD+α2×BQD+α3×LXD; wherein α1, α2 and α3 are weight coefficients, and α1, α2 and α3∈(0,1).

[0021] Furthermore, the step of generating the grammatical correctness level YZD, the clarity of expression level BQD and the domain relevance level LXD according to the input data comprises the following steps:

[0022] Step 1: Get input data; determine whether the input data is voice data; if yes, proceed to step 2; if no, proceed to step 3;

[0023] Step 2: Convert the content information in the voice data into text data;

[0024] Step 3: Obtain the grammatical correctness level YZD, the expression clarity level BQD and the domain relevance level LXD through the text degree model; the text degree model is constructed through a Transformer-based model.

[0025] Furthermore, the text degree model is constructed by a Transformer-based model, including:

[0026] Obtaining a number of historical text data and their corresponding grammatical correctness levels, expression clarity levels, and domain relevance levels;

[0027] Divide a number of historical text data and their corresponding grammatical correctness levels, expression clarity levels and domain relevance levels into training data, verification data and test data; perform text preprocessing on the training data, verification data and test data to obtain a training set, a verification set and a test set;

[0028] Select the Transformer-based model as the base model;

[0029] Train the basic model with the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model;

[0030] By verifying the pre-trained model on the test set, we finally get the input text data and output a text degree model with grammatical correctness level, expression clarity level and domain relevance level.

[0031] Furthermore, the standard coefficient threshold is obtained through historical SQL statements, including:

[0032] Obtain the data standardization coefficient SGXi corresponding to the correct labels of several historical SQL statements;

[0033] Select min(SGXi) as the normative coefficient threshold GXY.

[0034] Furthermore, the SQL generation model is obtained by combining the RAG technology with the large model, including:

[0035] Obtain historical text data in the field of power audit and its corresponding SQL statements;

[0036] Divide the historical text data and its corresponding SQL statements into training data, verification data and test data; perform data preprocessing on the training data, verification data and test data to obtain a training set, a verification set and a test set;

[0037] The large model is selected as the basic model, and the relevant data in the field of power audit is organized into a structured knowledge base; the basic model and the knowledge base are combined to obtain the RAG model;

[0038] Train the RAG model using the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model;

[0039] By verifying the pre-trained model on the test set, we finally get the SQL generation model whose input text data is the SQL statement and output is the SQL statement.

[0040] Compared with the prior art, the beneficial effects of the present application are: by identifying and verifying the input data; calculating the data standardization coefficient based on the input data; when the data standardization coefficient is greater than the standardization coefficient threshold, inputting the input data into the SQL generation model to obtain an SQL statement; otherwise, generating a prompt signal and re-entering the data, interacting through diversified data, and performing standardization verification on the input data before generating SQL statements, thereby reducing the number of statement generation times for non-standard information, and at the same time fine-tuning the large model in the field of power auditing, thereby improving the accuracy of SQL statement generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0042] Figure 1 This is a flow chart of a method for generating SQL statements for power auditing based on a large model in this application. DETAILED DESCRIPTION

[0043] The technical solution of the present application will be described clearly and completely in conjunction with the embodiments below. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0044] See also Figure 1 The first embodiment of the present application provides a method for generating SQL statements for power audit based on a large model, including:

[0045] S0: Get input data; the input data includes voice data or text data; the voice data includes voiceprint information and content information; determine whether the input data is voice data; if yes, go to S1; if no, go to S2;

[0046] S1: Obtain an identity tag from the voice data through an identity recognition model, which is constructed through an artificial intelligence model; determine whether the identity tag is a staff member; if yes, proceed to S2; if no, generate a no-authorization prompt signal and end the operation; identity tags include staff members and non-staff members;

[0047] S2: Calculate the data standardization coefficient based on the input data. The data standardization coefficient refers to the standardization degree of the text data; determine whether the data standardization coefficient is greater than the standardization coefficient threshold; if yes, proceed to S3; if no, generate a data non-standardization prompt signal, and remind you to re-enter the data, and proceed to S0;

[0048] S3: Input the input data into the SQL generation model to obtain the SQL statement; the SQL generation model is obtained by combining the RAG technology with the large model.

[0049] The identity recognition model in this embodiment is constructed by an artificial intelligence model, including:

[0050] Obtain historical voiceprint information and its corresponding identity tags; identity tags include staff and non-staff;

[0051] The historical voiceprint information is divided into training data, verification data and test data according to the identity label; the training data, verification data and test data are voiceprint preprocessed to obtain the training set, verification set and test set; the ratio between the training set, test set and verification set is 7:2:1;

[0052] Select an artificial intelligence model as the basic model; the artificial intelligence model includes a convolutional neural network model, such as VGGNet, ResNet, etc.;

[0053] Train the basic model with the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model;

[0054] By verifying the pre-trained model on the test set, we finally get the identity recognition model which inputs voiceprint information and outputs identity labels.

[0055] In this embodiment, calculating the data normalization coefficient according to the input data includes:

[0056] Get input data;

[0057] Generate grammatical correctness level YZD, expression clarity level BQD and domain relevance level LXD according to input data;

[0058] The data normalization coefficient is calculated by the formula SGX=α1×YZD+α2×BQD+α3×LXD; wherein α1, α2 and α3 are weight coefficients, α1, α2 and α3∈(0,1), and the specific values ​​are set according to experience; when the weight coefficients are determined, the data normalization coefficient increases with the increase of the grammatical correctness level, the expression clarity level and the domain relevance level.

[0059] This embodiment identifies the input data and obtains the grammatical correctness level, expression clarity level and domain relevance level through a text degree model; and obtains the data standardization coefficient by calculating the three situations according to different weights. This can accurately measure the standardization of the input data, avoid the problem of low accuracy of SQL statement generation caused by SQL statement generation based on input data with low standardization, and at the same time improve work efficiency.

[0060] In this embodiment, the process of generating the grammatical correctness level YZD, the expression clarity level BQD and the domain relevance level LXD according to the input data includes the following steps:

[0061] Step 1: Get input data; determine whether the input data is voice data; if yes, proceed to step 2; if no, proceed to step 3;

[0062] Step 2: Convert the content information in the voice data into text data;

[0063] Step 3: Obtain the grammatical correctness level YZD, the expression clarity level BQD and the domain relevance level LXD through the text degree model; the text degree model is constructed through a Transformer-based model.

[0064] The text degree model in this embodiment is constructed by a Transformer-based model, including:

[0065] Obtaining a number of historical text data and their corresponding grammatical correctness levels, expression clarity levels, and domain relevance levels;

[0066] Several historical text data and their corresponding grammatical correctness levels, expression clarity levels and domain relevance levels are divided into training data, verification data and test data; the training data, verification data and test data are subjected to text preprocessing to obtain training set, verification set and test set; the ratio between the training set, the test set and the verification set is 7:2:1;

[0067] Select the Transformer-based model as the base model; Transformer-based models such as the BERT model;

[0068] Train the basic model with the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model;

[0069] By verifying the pre-trained model on the test set, we finally get the input text data and output a text degree model with grammatical correctness level, expression clarity level and domain relevance level.

[0070] The standard coefficient threshold in this embodiment is obtained through historical SQL statements, including:

[0071] Obtain the data standardization coefficient SGXi corresponding to the correct labels of several historical SQL statements;

[0072] Select min(SGXi) as the normative coefficient threshold GXY.

[0073] The SQL generation model in this embodiment is obtained by combining RAG technology with a large model, including:

[0074] Obtain historical text data in the field of power audit and its corresponding SQL statements;

[0075] The historical text data and its corresponding SQL statements are divided into training data, verification data and test data; the training data, verification data and test data are preprocessed to obtain the training set, verification set and test set; the ratio between the training set, the test set and the verification set is 7:2:1;

[0076] The large model is selected as the basic model, and the relevant data in the field of power audit is organized into a structured knowledge base; the basic model and the knowledge base are combined to obtain the RAG model; the large model includes the T5 model and the GPT model, etc.;

[0077] Train the RAG model using the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model;

[0078] By verifying the pre-trained model on the test set, we finally get the SQL generation model whose input text data is the SQL statement and output is the SQL statement.

[0079] This embodiment combines RAG technology with a large model, conducts relevant training in the field of power auditing, and constructs a RAG model for SQL statement generation tasks in the field of power auditing. This model automatically generates corresponding SQL statements based on user needs, thereby improving the efficiency and accuracy of power auditing work.

[0080] Part of the data in the above formula is calculated by removing the dimension and taking its numerical value. The formula is a formula closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.

[0081] The working principle of the present application is as follows: by obtaining input data; identifying and verifying the input data; calculating the data normalization coefficient according to the input data; when the data normalization coefficient is greater than the normalization coefficient threshold, inputting the input data into the SQL generation model to obtain an SQL statement; otherwise, generating a prompt signal, and re-entering the data, interacting through diversified data, and performing normalization verification on the input data before generating SQL statements, thereby reducing the number of statement generation times for non-standard information, and at the same time fine-tuning the large model in the field of power auditing, thereby improving the accuracy of SQL statement generation, and avoiding the problem that the prior art directly generates SQL statements from text data, causing some text data with non-standard formats to generate erroneous SQL statements, resulting in low efficiency of power auditing work.

[0082] The above embodiments are only used to illustrate the technical method of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical method of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present application.

Claims

1. A method for generating SQL statements for power audit based on a large model, characterized in that: include: S0: Obtain input data; the input data includes voice data or text data; the voice data includes voiceprint information and content information; determine whether the input data is voice data; Yes, go to S1; No, go to S2; S1: Obtain an identity tag from the voice data through an identity recognition model, wherein the identity recognition model is constructed through an artificial intelligence model; determine whether the identity tag is a staff member; If yes, go to S2; if no, generate a no-authority prompt signal and end the operation; S2: Calculate the data normalization coefficient according to the input data; determine whether the data normalization coefficient is greater than the normalization coefficient threshold; if yes, proceed to S3; If no, a data irregularity prompt signal is generated, and the user is reminded to re-enter the data and enter S0; S3: Inputting the input data into the SQL generation model to obtain an SQL statement; the SQL generation model is obtained by combining the RAG technology with the large model.

2. According to the method for generating SQL statements for power audit based on a large model in claim 1, it is characterized in that: The identity recognition model is constructed through an artificial intelligence model, including: Obtain historical voiceprint information and its corresponding identity tag; Divide historical voiceprint information into training data, verification data, and test data according to identity labels; perform voiceprint preprocessing on the training data, verification data, and test data to obtain a training set, a verification set, and a test set; Select an AI model as the base model; Train the basic model with the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model; By verifying the pre-trained model on the test set, we finally get the identity recognition model which inputs voiceprint information and outputs identity labels.

3. The method for generating SQL statements for power audit based on a large model according to claim 1 is characterized in that: The step of calculating the data normalization coefficient according to the input data comprises: Get input data; Generate grammatical correctness level YZD, expression clarity level BQD and domain relevance level LXD according to input data; The data normalization coefficient is calculated by the formula SGX=α1×YZD+α2×BQD+α3×LXD; wherein α1, α2 and α3 are weight coefficients, and α1, α2 and α3∈(0,1).

4. The method for generating SQL statements for power audit based on a large model according to claim 3 is characterized in that: The method of generating the grammatical correctness grade YZD, the expression clarity grade BQD and the domain relevance grade LXD according to the input data comprises the following steps: Step 1: Get input data; determine whether the input data is voice data; if yes, proceed to step 2; if no, proceed to step 3; Step 2: Convert the content information in the voice data into text data; Step 3: Obtain the grammatical correctness level YZD, the expression clarity level BQD and the domain relevance level LXD through the text degree model; the text degree model is constructed through a Transformer-based model.

5. The method for generating SQL statements for power audit based on a large model according to claim 4 is characterized in that: The text degree model is constructed through a Transformer-based model, including: Obtaining a number of historical text data and their corresponding grammatical correctness levels, expression clarity levels, and domain relevance levels; Divide a number of historical text data and their corresponding grammatical correctness levels, expression clarity levels and domain relevance levels into training data, verification data and test data; perform text preprocessing on the training data, verification data and test data to obtain a training set, a verification set and a test set; Select the Transformer-based model as the base model; Train the basic model with the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model; By verifying the pre-trained model on the test set, we finally get the input text data and output a text degree model with grammatical correctness level, expression clarity level and domain relevance level.

6. The method for generating SQL statements for power audit based on a large model according to claim 1 is characterized in that: The standard coefficient threshold is obtained through historical SQL statements, including: Obtain the data standardization coefficient SGXi corresponding to the correct labels of several historical SQL statements; Select min(SGXi) as the normative coefficient threshold GXY.

7. The method for generating power audit SQL statements based on a large model according to claim 1 is characterized in that: The SQL generation model is obtained by combining RAG technology with a large model, including: Obtain historical text data in the field of power audit and its corresponding SQL statements; Divide the historical text data and its corresponding SQL statements into training data, verification data and test data; perform data preprocessing on the training data, verification data and test data to obtain a training set, a verification set and a test set; The large model is selected as the basic model, and the relevant data in the field of power audit is organized into a structured knowledge base; the basic model and the knowledge base are combined to obtain the RAG model; Train the RAG model using the training set, and adjust the learning rate and hyperparameters on the validation set to obtain the pre-trained model; By verifying the pre-trained model on the test set, we finally get the SQL generation model whose input text data is the SQL statement and output is the SQL statement.