Intelligent access method and device and readable storage medium

By preplacing the intelligent number fetching system on the big model and using named entity recognition and vector library technology to identify and generate SQL statements, the problems of large model illusion and low efficiency in the intelligent number fetching scheme are solved, and fast and efficient data is achieved Query.

CN119474134APending Publication Date: 2025-02-18CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411676750.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing intelligent number fetching scheme faces the problem of large-scale model hallucination and low efficiency and high resource overhead, making it difficult to meet the needs of fast and efficient data query.

Method used

By preplacing the intelligent number fetching system in the big model, using pre-built named entities to identify the NER model and vector library, obtain the user input problems, identify indicators, accounting periods and regional entities, find the standard entity names with the highest similarity, and calculate Confidence score. If the confidence score is greater than the threshold, an SQL statement is generated.

Benefits of technology

It significantly reduces the cost and response time of inference services, avoids the problem of large-scale model hallucinations, and improves the efficiency and resource utilization of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474134A_ABST
    Figure CN119474134A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent access method and device and a readable storage medium, and relates to the technical field of artificial intelligence, and the method comprises the steps: obtaining a question input by a user; obtaining a label sequence comprising three entities including an index, an account period and a region from the question through a pre-constructed NER model, and outputting a Viterbi score of the optimal label sequence; searching a pre-constructed vector library for a standard entity name having the highest similarity with the index, the account period and the region, and calculating according to a similarity value corresponding to the standard entity name to obtain a final similarity score; calculating a confidence score according to the Viterbi score and the final similarity score; and if the confidence score is greater than a preset threshold value, generating an SQL statement according to the standard entity name and the SQL template. According to the method, the device and the readable storage medium, the problems of large model illusion, low efficiency and large resource overhead of an existing intelligent access scheme can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an intelligent data acquisition method, device and readable storage medium. Background Art

[0002] With the growing demand for data analysis in various departments within the enterprise, the traditional method of manually writing SQL (Structured Query Language) statements for data extraction can no longer meet the needs of fast and efficient data query. To this end, basic telecommunications operators are actively exploring the construction of a set of NL2SQL (Natural Language to SQL) automatic data extraction tools to meet the needs of relevant business personnel for convenient and fast data extraction in data analysis. The current mainstream NL2SQL solution is based on a large model combined with RAG (Retrieval-Augmented Generation) technology. The user asks a question, and then the system searches the vector library to find relevant documents, database models, data dictionaries, and correct SQL answers. Based on this information, the system generates prompt words so that the large model can accurately generate SQL statements. Finally, the SQL database executes it.

[0003] However, although the current intelligent data retrieval solution has shown significant advantages in many aspects, it still faces two major challenges. First, the hallucination problem of large models cannot be completely solved, which is often catastrophic in data queries. Since the users of the NL2SQL system are often not professional data personnel, they cannot find abnormalities in the data results and directly use wrong data, which will lead to a series of chain errors. Secondly, efficiency and resource overhead issues cannot be ignored. The reasoning speed of large models is slow, and this problem is more serious when deployed privately. In a question-and-answer system, this will greatly reduce the user experience. At the same time, because it involves databases, enterprises will be more cautious when using external large model APIs (Application Programming Interfaces), and local deployment will require higher computing power. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide an intelligent data acquisition method, device and readable storage medium in view of the above-mentioned deficiencies in the prior art, so as to solve the problems of large model hallucination, low efficiency and high resource consumption in the existing intelligent data acquisition solutions.

[0005] In a first aspect, the present invention provides an intelligent data acquisition method, which is applied to an intelligent data acquisition system, wherein the intelligent data acquisition system is pre-placed in a large model, and the method comprises:

[0006] Get user input questions;

[0007] Obtain a label sequence including three entities, namely, indicator, account period and region, from the question through a pre-built named entity recognition (NER) model, and output a Viterbi score of the best label sequence;

[0008] Searching for the standard entity name with the highest similarity to the indicator, account period and region in the pre-built vector library, and calculating the final similarity score according to the similarity value corresponding to the standard entity name;

[0009] Calculating a confidence score based on the Viterbi score and the final similarity score;

[0010] If the confidence score is greater than a preset threshold, an SQL statement is generated according to the standard entity name and a structured query language SQL template.

[0011] Furthermore, the NER model includes a pre-trained model, a recursive neural network (RNN) model and a conditional random field (CRF) model. The pre-built named entity recognition (NER) model obtains a label sequence including three entities, namely, indicators, account periods and regions, from the question, and outputs a Viterbi score of the best label sequence, specifically including:

[0012] Inputting the question into the pre-trained model to obtain text features corresponding to the question;

[0013] Inputting the text feature into the RNN model to obtain the score of each BIO tag corresponding to the text feature;

[0014] The score of each BIO label is input into the CRF model, the label sequence of the BIO labeling method is obtained using the Viterbi algorithm and the transition probability, and the Viterbi score of the best label sequence is output, wherein the best label sequence is the label sequence with the highest Viterbi score.

[0015] Furthermore, the pre-trained model is a 6-layer RoBERTa-wwm-ext model, and the RNN model is a long short-term memory network LSTM model.

[0016] Furthermore, searching the pre-built vector library for the standard entity name with the highest similarity to the indicator, account period and region specifically includes:

[0017] Vectorize the indicators, account periods and regions;

[0018] The vectorized indicators, account periods and regions are subjected to similarity query in a pre-built vector library to obtain the standard entity name with the highest similarity.

[0019] Furthermore, the calculating of the final similarity score according to the similarity value corresponding to the standard entity name specifically includes:

[0020] The similarity values ​​corresponding to all the standard entity names are averaged to obtain the final similarity score.

[0021] Further, the confidence score is calculated according to the Viterbi score and the final similarity score, specifically including:

[0022] The confidence score is obtained by multiplying the Viterbi score and the final similarity score.

[0023] Furthermore, the method further comprises:

[0024] If the confidence score is less than or equal to the preset threshold, the big model is connected to generate an SQL statement based on the question input by the user.

[0025] In a second aspect, the present invention provides an intelligent data acquisition device, which is arranged in an intelligent data acquisition system, and the intelligent data acquisition system is placed in front of a large model, and the device comprises:

[0026] The question acquisition module is used to obtain the questions input by the user;

[0027] A Viterbi score acquisition module, connected to the question acquisition module, is used to obtain a label sequence including three entities of indicators, account period and region from the question through a pre-built named entity recognition (NER) model, and output a Viterbi score of the best label sequence;

[0028] A similarity score acquisition module, connected to the Viterbi score acquisition module, is used to search the pre-built vector library for the standard entity name with the highest similarity to the indicator, account period and region, and calculate the final similarity score according to the similarity value corresponding to the standard entity name;

[0029] A confidence score acquisition module, connected to the similarity score acquisition module, for calculating a confidence score according to the Viterbi score and a final similarity score;

[0030] A query statement generating module is connected to the confidence score acquiring module and is used to generate an SQL statement according to the standard entity name and a structured query language SQL template if the confidence score is greater than a preset threshold.

[0031] In a third aspect, the present invention provides an intelligent data acquisition device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the intelligent data acquisition method described in the first aspect.

[0032] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the intelligent data acquisition method described in the first aspect is implemented.

[0033] The intelligent data acquisition method, device and readable storage medium provided by the present invention. First, obtain the question input by the user; and obtain the label sequence of three entities including indicators, account periods and regions from the question through a pre-built named entity recognition (NER) model, and output the Viterbi score of the best label sequence; then search the pre-built vector library for the standard entity name with the highest similarity to the indicator, account period and region, and calculate the final similarity score according to the similarity value corresponding to the standard entity name; then calculate the confidence score according to the Viterbi score and the final similarity score; finally, if the confidence score is greater than the preset threshold, generate an SQL statement according to the standard entity name and the structured query language SQL template. The present invention generates SQL statements by pre-setting the intelligent data acquisition system of the large model, which can significantly reduce the cost of reasoning services and improve the response speed. At the same time, when the confidence is high, the system will avoid accessing the large model for further processing, thereby effectively avoiding the problem of large model hallucination, and solving the problems of large model hallucination, low efficiency and high resource overhead in the existing intelligent data acquisition scheme. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 This is a flow chart of an intelligent data acquisition method according to Embodiment 1 of the present invention;

[0035] Figure 2 A flowchart of another intelligent data acquisition method according to an embodiment of the present invention;

[0036] Figure 3 A flowchart of named entity recognition according to an embodiment of the present invention;

[0037] Figure 4 A flowchart of fuzzy matching according to an embodiment of the present invention;

[0038] Figure 5 This is a schematic diagram of the structure of an intelligent data acquisition device according to Embodiment 2 of the present invention;

[0039] Figure 6 This is a schematic diagram of the structure of an intelligent data acquisition device according to embodiment 3 of the present invention. DETAILED DESCRIPTION

[0040] In order to enable those skilled in the art to better understand the technical solution of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0041] It should be understood that the specific embodiments and drawings described herein are only used to explain the present invention rather than to limit the present invention.

[0042] It can be understood that, in the absence of conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other.

[0043] It can be understood that, for the convenience of description, the drawings of the present invention only show the parts related to the present invention, while the parts irrelevant to the present invention are not shown in the drawings.

[0044] It can be understood that each unit and module involved in the embodiments of the present invention may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.

[0045] It can be understood that the terms "first", "second", etc. in the embodiments of the present invention are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.

[0046] It can be understood that, without conflict, the functions and steps marked in the flowcharts and block diagrams of the present invention may occur in an order different from that marked in the drawings.

[0047] It is understood that the flowcharts and block diagrams of the present invention illustrate the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the various embodiments of the present invention. Each box in the flowchart or block diagram may represent a unit, module, program segment, or code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or may be implemented by a combination of hardware and computer instructions.

[0048] It can be understood that the units and modules involved in the embodiments of the present invention can be implemented by software or hardware. For example, the units and modules can be located in a processor.

[0049] Embodiment 1:

[0050] This embodiment provides an intelligent data acquisition method, which is applied to an intelligent data acquisition system. The intelligent data acquisition system is pre-placed in a large model, such as Figure 1 As shown, the method includes:

[0051] Step S101: Obtain the question input by the user.

[0052] In this embodiment, the intelligent data acquisition system is placed in front of the large model to reduce a lot of response time and system expenses. When the user inputs a question, the intelligent data acquisition system obtains the question input by the user. It should be noted that "placed in front" means placing the intelligent data acquisition system before or in front of the large model, and the intelligent data acquisition system works before the large model processes the data.

[0053] Step S102: Obtain a label sequence including three entities, namely, indicators, account periods and regions, from the question through a pre-built NER (Named Entity Recognition) model, and output a Viterbi score of the best label sequence.

[0054] In this embodiment, the NER model is trained in a general manner using a data set of user questions and corresponding BIO tag sequences.

[0055] Optionally, the NER model includes a pre-trained model, an RNN (Recurrent Neural Network) model and a CRF (conditional random field) model, and the pre-built named entity recognition NER model obtains a label sequence including three entities of indicators, account periods and regions from the question, and outputs a Viterbi score of the best label sequence, specifically including:

[0056] Inputting the question into the pre-trained model to obtain text features corresponding to the question;

[0057] Inputting the text feature into the RNN model to obtain the score of each BIO tag corresponding to the text feature;

[0058] The score of each BIO label is input into the CRF model, the label sequence of the BIO labeling method is obtained using the Viterbi algorithm and the transition probability, and the Viterbi score of the best label sequence is output, wherein the best label sequence is the label sequence with the highest Viterbi score.

[0059] In this embodiment, the pre-trained model has been trained on a large amount of text data, so it has the ability to extract text features. The user question is input into the pre-trained model to obtain text features; these features are converted into scores for each BIO tag after entering the RNN model, corresponding to all tags of the BIO tagging method. The higher the score, the greater the possibility that the text belongs to the tag; after the score is input into the CRF model, the Viterbi algorithm and transition probability are used to obtain the tag sequence of the BIO tagging method, namely the three entities of indicators, account periods and regions, and the Viterbi score Score1 of the best tag sequence will be output.

[0060] It should be noted that BIO is a commonly used sequence annotation method, and its full name is Begin, Inside, Outside. This method is mainly used in tasks such as named entity recognition, which identifies the entity category to which each element in the text belongs by assigning one or more labels to each element in the text.

[0061] B (Begin): Indicates that the current word is the beginning of an entity.

[0062] I (Inside): Indicates that the current word is inside an entity, that is, the word is a component of an entity.

[0063] O (Outside): Indicates that the current word does not belong to any entity, that is, the word is not a component of any entity.

[0064] Optionally, the pre-trained model is a 6-layer RoBERTa-wwm-ext model, and the RNN model is an LSTM (Long Short-Term Memory) model.

[0065] It should be noted that the RoBERTa-wwm-ext model is a pre-trained model based on the RoBERTa architecture. Specifically, "RoBERTa" refers to "Robustly optimized BERT approach", which is an improved version of BERT (Bidirectional Encoder Representation Transformer) that pays more attention to the model training strategy; "wwm" refers to "Whole Word Masking", which means that when a word is masked during training, the entire word will be masked instead of just a subword (such as a root or affix). This reduces the model's learning confusion about word boundaries, thereby improving the ability to understand sentences. "ext" refers to "Extended", which usually means that this model has been expanded or additionally pre-trained on certain specific corpora, such as using larger or richer text datasets to enhance the model's performance on specific tasks. The RoBERTa-wwm-ext model has been expanded on the basis of the original large-scale Chinese text data to cover more fields and topics. This makes the model more generalizable and able to handle more diverse Chinese text tasks, with features such as full-word masking, extended pre-training data, and longer sequence length. It has demonstrated high accuracy and strong generalization capabilities in Chinese natural language processing tasks, and can be flexibly applied to various tasks.

[0066] In this embodiment, the number of layers of the RoBERTa-wwm-ext model will affect the complexity and learning ability of the model. The pre-trained model in the present invention is preferably a 6-layer RoBERTa-wwm-ext model, referred to as the rbt6 model. The rbt6 model has the characteristics of 6 Transformer encoder layers, full-word masking strategy and Chinese optimization. It has shown high precision and strong generalization ability in Chinese natural language processing tasks, and can be flexibly applied to various tasks. The RNN model is preferably an LSTM model. After the text features are input into the LSTM model, the model generates a score corresponding to each BIO tag. The higher the score, the greater the possibility that the text feature belongs to the tag. This means that the LSTM model can effectively evaluate the importance and applicability of each tag in the current context by processing the input text features.

[0067] Step S103: searching the pre-built vector library for the standard entity name with the highest similarity to the indicator, account period and region, and calculating the final similarity score according to the similarity value corresponding to the standard entity name.

[0068] In this embodiment, the vector library is a pre-built knowledge base of related entities, and a commonly used synonym configuration can be optionally added.

[0069] Optionally, searching the pre-built vector library for a standard entity name with the highest similarity to the indicator, account period and region specifically includes:

[0070] Vectorize the indicators, account periods and regions;

[0071] The vectorized indicators, account periods and regions are subjected to similarity query in a pre-built vector library to obtain the standard entity name with the highest similarity.

[0072] In this embodiment, the entities output by NER can be vectorized using the piccolo-large-zh model, which is a powerful Chinese pre-trained model. Using the piccolo-large-zh model for vectorization, these entities can be converted into high-dimensional vector representations. These vectors can retain the semantic information of the entities. Through this vectorization, the model can effectively capture the relationship between entities in the semantic space, supporting further analysis and application.

[0073] In this embodiment, the vectorized entity is queried for similarity in the vector library to obtain the standard entity name with the closest semantics, that is, the standard entity name with the highest similarity value.

[0074] Optionally, the calculating a final similarity score according to the similarity value corresponding to the standard entity name specifically includes:

[0075] The similarity values ​​corresponding to all the standard entity names are averaged to obtain the final similarity score.

[0076] In this embodiment, cosine similarity is preferably used to measure the similarity of two vectors, and the final similarity score is the average cosine similarity Score2 of all corresponding standard entities.

[0077] It should be noted that in addition to cosine similarity, the similarity between two vectors can also be measured by Euclidean distance, Manhattan distance, Jaccard similarity coefficient, etc.

[0078] Step S104: Calculate a confidence score according to the Viterbi score and the final similarity score.

[0079] In this embodiment, the confidence score may be calculated according to the Viterbi score and the final similarity score in a preset calculation manner.

[0080] Optionally, the calculating a confidence score according to the Viterbi score and the final similarity score specifically includes:

[0081] The confidence score is obtained by multiplying the Viterbi score and the final similarity score.

[0082] In this embodiment, considering that the Viterbi score score1 can be understood as an entity sequence score, the final similarity score score2 can be used to indicate whether a corresponding entity can be found under the entity sequence, so the multiplication result is used for judgment.

[0083] Step S105: If the confidence score is greater than a preset threshold, a SQL statement is generated according to the standard entity name and a structured query language SQL template.

[0084] In this embodiment, if the confidence score is greater than the preset threshold, it is proven to be credible. At this time, the standard entity name can be filled into the slot of the SQL template to generate a complete SQL statement for entering the database (database used for data retrieval) for query.

[0085] It should be noted that the SQL template refers to a predefined SQL query structure, which contains some variable parts (i.e., "grooves"). These variable parts can be represented by placeholders, which will form a complete SQL statement after being filled.

[0086] Optionally, the method further comprises:

[0087] If the confidence score is less than or equal to the preset threshold, the big model is connected to generate an SQL statement based on the question input by the user.

[0088] In this embodiment, if the confidence score is less than or equal to the preset threshold, it is proved to be unreliable. At this time, a large model can be connected to generate SQL statements based on the questions input by the user.

[0089] It should be noted that the intelligent data acquisition method provided by the embodiment of the present invention can greatly reduce the cost of reasoning services and optimize the response speed, while not affecting the system's response to complex problems. Combined with the actual situation, this method can be applied to the indicator query system.

[0090] In a specific embodiment, the intelligent data acquisition system implements the NL2SQL function based on three modules: named entity recognition, fuzzy matching, and SQL generation. The system can be pre-placed in a large model to reduce a lot of response time and system expenses. The flowchart of the intelligent data acquisition method can be as follows Figure 2 As shown, the following steps are included:

[0091] Step 1: Named Entity Recognition (NER)

[0092] The named entity recognition model constructed by the present invention is composed of a pre-trained model rbt6, a long short-term memory network (LSTM) and a conditional random field (CRF). Figure 3 shows a flowchart of named entity recognition, combined with Figure 3 , the steps of NER include:

[0093] (1) RBT6 has been trained on a large amount of text data, so it has the ability to extract text features. Input user questions into the pre-trained model to obtain text features;

[0094] It should be noted that rbt6 is a 6-layer RoBERTa-wwm-ext model. The 6-layer RoBERTa-wwm-ext model is a pre-trained model optimized for Chinese. It has 6 Transformer encoder layers, full-word masking strategy, and Chinese optimization. It has shown high accuracy and strong generalization ability in Chinese natural language processing tasks, and can be flexibly applied to various tasks. Chinese is converted into Figure 3 The bottom weight.

[0095] (2) These features enter the LSTM and are converted into scores for each label. This corresponds to all labels in the BIO annotation method. The higher the score, the greater the possibility that the text belongs to the label;

[0096] (3) After the scores are input into CRF, the Viterbi algorithm and transition probability are used to obtain the label sequence of the BIO labeling method, namely the three entities of indicator, account period and region;

[0097] It should be noted that Figure 3 The B in it indicates the beginning of the entity, KPI is the indicator entity, I indicates the inside of the entity, O is the non-entity part, and the right side is the corresponding probability (the value is just a random example). Figure 3 The output entity is above. According to the original probability, the fourth one should be I-YEAR, but this does not conform to the BIO annotation rule (it is preceded by O, and the YEAR entity must start with B-YEAR), so the output after CRF is B-KPI.

[0098] Suppose the question is: What is Zhejiang's dual-line business revenue in July 24?

[0099] The tag sequence can be as follows:

[0100] B-YEAR(2)

[0101] I-YEAR(4)

[0102] I-YEAR

[0103] B-MONTH(7)

[0104] I-MONTH(Month)

[0105] O(,)

[0106] B-AREA(Zhejiang)

[0107] I-AREA(Jiang)

[0108] O

[0109] B-KPI (double)

[0110] I-KPI(line)

[0111] I-KPI(Industry)

[0112] I-KPI(Service)

[0113] I-KPI(receive)

[0114] I-KPI(Enter)

[0115] O (Yes)

[0116] O(many)

[0117] O(less)

[0118] O(?)

[0119] With these tags, you can get the corresponding entity

[0120] (4) The Viterbi score Score1 of the CRF best queue (i.e., the best label sequence) will be output.

[0121] Step 2: Fuzzy matching

[0122] The flowchart of fuzzy matching is as follows Figure 4 As shown below, combined Figure 4 Introduce the steps of fuzzy matching:

[0123] (1) The entities output by NER are vectorized using the piccolo-large-zh model;

[0124] The piccolo-large-zh model is a powerful Chinese pre-training model that vectorizes entities (such as names, places, organizations, etc.) identified in the NER task using the piccolo-large-zh model, which can convert these entities into high-dimensional vector representations. These vectors can retain the semantic information of the entities. Through this vectorization, the model can effectively capture the relationship between entities in the semantic space, supporting further analysis and application.

[0125] (2) After vectorization, similarity query is performed in the vector library to obtain the standard entity name with the closest semantics, and the average cosine similarity Score2 of all corresponding standard entities is output;

[0126] Specifically, the entity with the highest similarity to the three entities of indicator, account period and region is found, and then the three highest similarity values ​​are averaged to obtain the average cosine similarity Score2.

[0127] (3) Complete the entity. For example, if a user asks "January" for the account period entity, the year will be automatically completed as the current year. Finally, the module outputs a complete and standard entity name.

[0128] For example, if the question is about the xxx indicator in January, and the year is not mentioned, it is assumed to refer to January of that year, and the year will be completed, such as 2024.

[0129] Step 3: SQL generation

[0130] The following are the steps for generating SQL:

[0131] (1) Score 1 output by NER and Score 2 output by fuzzy matching have been obtained, and judgment is made according to the following formula:

[0132]

[0133] When the score is lower than the set threshold, you can connect to a larger model or perform other operations.

[0134] It should be noted that, considering that score1 can be understood as the entity sequence score, score2 can be used to indicate whether the corresponding entity can be found under the entity sequence, so the multiplication result is used for judgment, but in practical applications, other calculation methods can also be used.

[0135] (2) When the score is higher than the set threshold, the entity is filled into the slot of the SQL template to generate a complete SQL statement for querying the database (the database used to retrieve data).

[0136] Specifically, when the score is higher than the set threshold, the matched standard entity name is filled into the slot of the SQL template to generate a complete SQL statement for entering the database query; when the score is lower than the set threshold, the big model directly generates the SQL statement based on the question entered by the user. The big model does not rely on the system.

[0137] It should be noted that the above process is for inference services. During the model building process, the following preparations need to be made:

[0138] Prepare a dataset of user questions and corresponding BIO tag sequences, and train the NER model in a general way.

[0139] Vector knowledge base (i.e. vector library), prepares the knowledge base of related entities, and can choose to add common synonym configurations.

[0140] It should be noted that in the above embodiment, the pre-trained model can use any other Chinese pre-trained model, LSTM can be replaced by any RNN type model, such as GRU, BiLSTM, and the fuzzy matching module can be replaced by any similarity scheme, such as Euclidean distance. Other methods can also be used to combine the CRF network and similarity score as the basis for model confidence, such as addition.

[0141] It should be noted that the intelligent data acquisition method provided by the present invention is based on named entity recognition, and the recognition module is based on a smaller pre-trained model, which greatly reduces the number of parameters and can accurately complete all single data queries. At the same time, the model provides a confidence score, and users can expand it according to the score. When the score is low, a large model can be connected to deal with complex problems. Since the model can cover most situations in real scenarios, this greatly reduces the system computing power expenditure and service response time.

[0142] The intelligent data acquisition method provided by the embodiment of the present invention first obtains the question input by the user; and obtains the label sequence of three entities including indicators, account periods and regions from the question through a pre-built named entity recognition (NER) model, and outputs the Viterbi score of the best label sequence; then searches the pre-built vector library for the standard entity name with the highest similarity to the indicator, account period and region, and calculates the final similarity score according to the similarity value corresponding to the standard entity name; then calculates the confidence score according to the Viterbi score and the final similarity score; finally, if the confidence score is greater than a preset threshold, generates an SQL statement according to the standard entity name and a structured query language SQL template. The present invention generates SQL statements by pre-setting the intelligent data acquisition system of the large model, which can significantly reduce the cost of reasoning services and improve the response speed. At the same time, when the confidence is high, the system will avoid accessing the large model for further processing, thereby effectively avoiding the problem of large model hallucination, and solving the problems of large model hallucination, low efficiency and high resource overhead in the existing intelligent data acquisition scheme.

[0143] Embodiment 2:

[0144] like Figure 5 As shown, this embodiment provides an intelligent data acquisition device, which is arranged in an intelligent data acquisition system. The intelligent data acquisition system is placed in front of a large model. The device includes:

[0145] The question acquisition module 11 is used to acquire the question input by the user;

[0146] A Viterbi score acquisition module 12, connected to the question acquisition module 11, is used to obtain a label sequence including three entities of indicators, account period and region from the question through a pre-built named entity recognition (NER) model, and output a Viterbi score of the best label sequence;

[0147] A similarity score acquisition module 13, connected to the Viterbi score acquisition module 12, is used to search the pre-built vector library for the standard entity name with the highest similarity to the indicator, account period and region, and calculate the final similarity score according to the similarity value corresponding to the standard entity name;

[0148] A confidence score acquisition module 14, connected to the similarity score acquisition module 13, for calculating a confidence score according to the Viterbi score and the final similarity score;

[0149] The query statement generating module 15 is connected to the confidence score acquiring module 14 and is used to generate an SQL statement according to the standard entity name and the structured query language SQL template if the confidence score is greater than a preset threshold.

[0150] Optionally, the NER model includes a pre-trained model, a recursive neural network (RNN) model and a conditional random field (CRF) model, and the Viterbi score acquisition module 12 includes:

[0151] A text feature acquisition unit, used for inputting the question into the pre-trained model to obtain text features corresponding to the question;

[0152] A label score acquisition unit, used for inputting the text feature into the RNN model to obtain the score of each BIO label corresponding to the text feature;

[0153] The Viterbi score acquisition unit is used to input the score of each BIO label into the CRF model, use the Viterbi algorithm and the transition probability to obtain the label sequence of the BIO labeling method, and output the Viterbi score of the best label sequence, wherein the best label sequence is the label sequence with the highest Viterbi score.

[0154] Optionally, the pre-trained model is a 6-layer RoBERTa-wwm-ext model, and the RNN model is a long short-term memory network LSTM model.

[0155] Optionally, the similarity score acquisition module 13 includes:

[0156] A vectorization unit, used for vectorizing the indicators, account periods and regions;

[0157] The similarity query unit is used to perform a similarity query on the vectorized indicators, account periods and regions in a pre-built vector library to obtain the standard entity name with the highest similarity.

[0158] Optionally, the similarity score acquisition module 13 further includes:

[0159] The similarity score calculation unit is used to average the similarity values ​​corresponding to all the standard entity names to obtain the final similarity score.

[0160] Optionally, the confidence score acquisition module 14 is specifically used to:

[0161] The confidence score is obtained by multiplying the Viterbi score and the final similarity score.

[0162] Optionally, the device further comprises:

[0163] The large model access module is used to access the large model if the confidence score is less than or equal to a preset threshold, and the large model generates an SQL statement according to the question input by the user.

[0164] Embodiment 3:

[0165] refer to Figure 6 This embodiment provides an intelligent data acquisition device, including a memory 21 and a processor 22. The memory 21 stores a computer program, and the processor 22 is configured to run the computer program to execute the intelligent data acquisition method in Example 1.

[0166] The memory 21 is connected to the processor 22. The memory 21 may be a flash memory, a read-only memory or other memory. The processor 22 may be a central processing unit or a single-chip microcomputer.

[0167] Embodiment 4:

[0168] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the intelligent data acquisition method in the above-mentioned embodiment 1 is implemented.

[0169] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.

[0170] In summary, the intelligent data acquisition method, device and readable storage medium provided by the embodiment of the present invention first obtain the question input by the user; and obtain the label sequence of three entities including indicators, account periods and regions from the question through the pre-built named entity recognition NER model, and output the Viterbi score of the best label sequence; then search the standard entity name with the highest similarity to the indicators, account periods and regions in the pre-built vector library, and calculate the final similarity score according to the similarity value corresponding to the standard entity name; then calculate the confidence score according to the Viterbi score and the final similarity score; finally, if the confidence score is greater than the preset threshold, generate SQL statements according to the standard entity name and the structured query language SQL template. The present invention generates SQL statements by pre-setting the intelligent data acquisition system of the large model, which can significantly reduce the cost of reasoning services and improve the response speed. At the same time, when the confidence is high, the system will avoid accessing the large model for further processing, thereby effectively avoiding the problem of large model hallucination, and solving the problems of large model hallucination, low efficiency and high resource overhead in the existing intelligent data acquisition scheme.

[0171] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. An intelligent data acquisition method, characterized in that: Applied to an intelligent data acquisition system, the intelligent data acquisition system is placed in front of a large model, and the method includes: Get user input questions; Obtain a label sequence including three entities, namely, indicator, account period and region, from the question through a pre-built named entity recognition (NER) model, and output a Viterbi score of the best label sequence; Searching for the standard entity name with the highest similarity to the indicator, account period and region in the pre-built vector library, and calculating the final similarity score according to the similarity value corresponding to the standard entity name; Calculating a confidence score based on the Viterbi score and the final similarity score; If the confidence score is greater than a preset threshold, an SQL statement is generated according to the standard entity name and a structured query language SQL template.

2. The method according to claim 1, characterized in that The NER model includes a pre-trained model, a recursive neural network (RNN) model and a conditional random field (CRF) model. The pre-built named entity recognition (NER) model obtains a label sequence including three entities, namely, indicators, account periods and regions, from the question, and outputs a Viterbi score of the best label sequence, specifically including: Inputting the question into the pre-trained model to obtain text features corresponding to the question; Inputting the text feature into the RNN model to obtain the score of each BIO tag corresponding to the text feature; The score of each BIO label is input into the CRF model, the label sequence of the BIO labeling method is obtained using the Viterbi algorithm and the transition probability, and the Viterbi score of the best label sequence is output, wherein the best label sequence is the label sequence with the highest Viterbi score.

3. The method according to claim 2, characterized in that The pre-trained model is a 6-layer RoBERTa-wwm-ext model, and the RNN model is a long short-term memory network LSTM model.

4. The method according to claim 2, characterized in that: The searching of the pre-built vector library for the standard entity name with the highest similarity to the indicator, account period and region specifically includes: Vectorize the indicators, account periods and regions; The vectorized indicators, account periods and regions are subjected to similarity query in a pre-built vector library to obtain the standard entity name with the highest similarity.

5. The method according to claim 1, characterized in that The calculating of the final similarity score according to the similarity value corresponding to the standard entity name specifically includes: The similarity values ​​corresponding to all the standard entity names are averaged to obtain the final similarity score.

6. The method according to claim 1, characterized in that The confidence score is calculated based on the Viterbi score and the final similarity score, specifically including: The confidence score is obtained by multiplying the Viterbi score and the final similarity score.

7. The method according to claim 1, characterized in that The method further comprises: If the confidence score is less than or equal to the preset threshold, the big model is connected to generate an SQL statement based on the question input by the user.

8. An intelligent data acquisition device, characterized in that: It is arranged in an intelligent data acquisition system, and the intelligent data acquisition system is placed in front of a large model. The device includes: The question acquisition module is used to obtain the questions input by the user; A Viterbi score acquisition module, connected to the question acquisition module, is used to obtain a label sequence including three entities of indicators, account period and region from the question through a pre-built named entity recognition (NER) model, and output a Viterbi score of the best label sequence; A similarity score acquisition module, connected to the Viterbi score acquisition module, is used to search the pre-built vector library for the standard entity name with the highest similarity to the indicator, account period and region, and calculate the final similarity score according to the similarity value corresponding to the standard entity name; A confidence score acquisition module, connected to the similarity score acquisition module, for calculating a confidence score according to the Viterbi score and a final similarity score; A query statement generating module is connected to the confidence score acquiring module and is used to generate an SQL statement according to the standard entity name and a structured query language SQL template if the confidence score is greater than a preset threshold.

9. An intelligent data acquisition device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the intelligent data acquisition method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the intelligent data acquisition method according to any one of claims 1 to 7 is implemented.