Database reasoning method and device based on large model
Through the database inference method based on large models, vectorization processing and keyword matching technology are used to solve the problems of low efficiency and accuracy in the existing technology, realize efficient and accurate query of multi-source data sets, and adapt to a variety of business scenarios. Improved user experience.
Patent Information
- Application Number
- CN202411105766.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-10-29
AI Technical Summary
The existing database inference system relies on manual setting of model parameters and parameter adjustment, which is inefficient, and the accuracy of data inference results is difficult to guarantee, and cannot meet the needs of multi-source business processing.
Using a database reasoning method based on a large model, through vectorization processing and keyword matching technology, multi-source data sets are preprocessed, word segmentation is converted into word vectors, partitioned storage and mapping relationships are constructed, vector service data interfaces are generated, and user input is intercepted Convert it into a search vector, match the target vector data table, and generate a database query statement for query.
It improves retrieval efficiency and accuracy, reduces dependence on manual operations, can flexibly adapt to a variety of business scenarios, and generates accurate query results without requiring users to master database knowledge.
Smart Images

Figure CN118861084A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of spatiotemporal information processing technology, and in particular to a database reasoning method and device based on a large model. Background Art
[0002] With the continuous development and popularization of artificial intelligence (AI) technology, more and more people are beginning to use AI tools to assist in solving various practical problems at work and improve work efficiency. At present, in the process of spatiotemporal information business processing, machine learning is also used to search for information that meets user needs from a large and complex database and perform corresponding reasoning and prediction. Although these database reasoning systems are constantly improving, they still cannot meet users' needs for data mining, text processing, intelligent retrieval, etc.
[0003] For the semantic parsing of database statements, supervised semantic parsing methods use manually annotated parsing results as training labels to train the parsing model, which makes the model highly dependent on manually annotated data. Weakly supervised semantic parsing methods use a small amount of annotated data or rules based on manual construction as training data. These training data may not be complete or accurate enough, resulting in low accuracy of the final reasoning results. The existing technologies all have the problem of poor model generalization ability. When faced with new or complex query statements, their parsing results may be inaccurate and difficult to adapt to various expressions of data structures from a semantic level. Although the existing database reasoning system can realize traditional database statement conditional query, it is based on a single type of database for reasoning and cannot meet people's needs for multi-source business processing. Traditional data matching and data reasoning mainly rely on manually set models and parameter adjustments, which not only increases the workload of developers, but also has low efficiency and limited scope of application. Summary of the invention
[0004] The embodiment of the present application provides a database reasoning method and device based on a large model, which solves the problem that the prior art relies on manual setting of model parameters and parameter adjustment, which is inefficient and difficult to guarantee the accuracy of data reasoning results. By using improved vectorization processing and keyword matching technology, the multi-target database information is fully captured, and various business scenarios are flexibly adapted. The reasoning of the multi-target database based on the large model is realized and converted to generate database query statements. The corresponding database method is executed to complete the data query to retrieve the information required by the user, which can enhance the user's experience and improve the retrieval efficiency and accuracy.
[0005] In a first aspect, an embodiment of the present application provides a database reasoning method based on a large model, including: preprocessing a multi-source data set to obtain a target data set; segmenting the target data set and converting it into word vectors to form a word vector set; partitioning and storing the word vector set based on its source to generate multiple vector data tables, and setting a vector table ID for the vector data table; constructing a mapping relationship based on the attribute information of the multiple vector data tables, and generating a vector service data interface based on the mapping relationship; intercepting the user's search input before it reaches the server, and calling the vector service data interface to convert the search input into a search vector; matching the vector data table for the search vector to obtain a first number of target vector data tables; converting the search vector into a database query statement, and querying the first number of target vector data tables through the database query statement; filtering and sorting the query results and sending them to the user interface.
[0006] In a possible implementation, the preprocessing of the multi-source data set to obtain the target data set includes: performing data cleaning on the multi-source data set to remove outliers, fill in missing values, and correct erroneous values; and / or removing data that is not related to the target business in the multi-source data set after data cleaning, and verifying the remaining data to obtain an initial data set; and / or lowercasing the initial data in the initial data set and removing meaningless characters therein to obtain the target data set.
[0007] In one possible implementation, the word segmentation and conversion of the target data set into word vectors includes: dividing the target data in the target data set into word units, and adding markers to the word units to mark the relationship between the word units; obtaining the unit ID of each word unit through a vocabulary; padding or truncating the word units to a set length according to input requirements; and converting the word units of the set length into the word vectors.
[0008] In a possible implementation, after segmenting the target data set and converting it into word vectors, the method further includes: embedding position information and paragraph information in the word vectors.
[0009] In one possible implementation, the partitioning and storage based on the source of the word vector set generates multiple vector data tables, including: establishing a connection between the word vector set and a database, and obtaining data information of the word vector set; wherein the data information includes a unit ID and a vector data type; obtaining form information of a data table in a database; wherein the form information includes a data table name, a character set, index information, a storage engine, a sorting rule, and field information, and the field information includes a field name, a data type, and a field comment; cleaning the form information to make it consistent with the data information corresponding to the word vector set; storing the word vector set in the vector data table, partitioning it according to the source of the word vector to obtain multiple vector data tables, and setting a data table ID and a corresponding database ID.
[0010] In a possible implementation, the vector table ID is composed of the data table ID and the corresponding database ID.
[0011] In a possible implementation, before querying the first number of target vector data tables through the database query statement, the method includes: storing the partitioned vector data tables in a data source management platform, and matching the vector data tables in the data source management platform according to the search vector.
[0012] In the second aspect, an embodiment of the present application provides a database reasoning device based on a large model, including: a data processing module, which is used to preprocess a multi-source data set to obtain a target data set; segment the target data set and convert it into word vectors to form a word vector set; a storage module, which is used to partition and store the word vector set based on its source to generate multiple vector data tables, and set a vector table ID for the vector data table; a matching module, which is used to construct a mapping relationship based on the attribute information of multiple vector data tables, and generate a vector service data interface based on the mapping relationship; intercept the user's search input before it reaches the server, and call the vector service data interface to convert the search input into a search vector; match the vector data table for the search vector to obtain a first number of target vector data tables; an inference module, which is used to convert the search vector into a database query statement, and query the first number of target vector data tables through the database query statement; a retrieval module, which is used to filter and sort the query results and send them to the user interface.
[0013] In a third aspect, an embodiment of the present application provides a device for a database reasoning method based on a large model, the device comprising: a processor; a memory for storing processor executable instructions; when the processor executes the executable instructions, it implements the method described in the first aspect or any possible implementation method of the first aspect.
[0014] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium includes a medium for storing a computer program or instructions, which, when executed, enables the method described in the first aspect or any possible implementation method of the first aspect to be implemented.
[0015] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: The embodiment of the present application adopts a database reasoning method and device based on a large model, and completes the vectorization processing of data by calling the vector service interface. Partitioning storage according to the data source and building an index can improve the retrieval efficiency. By using the similarity calculation of the vector, the business model with the highest similarity is matched and inferred, and the database query statement is converted and generated. The generated database query statement is executed to search the target database, which effectively solves the problem of low accuracy of the results of the database reasoning system in the prior art and low efficiency of adjusting parameters by manually setting the model. It can then start from the influencing factors such as the source and format of the data, so that users can automatically generate high-accuracy query results by simply entering the query keywords without having to master the relevant knowledge of the database, which can improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 A flowchart of a database reasoning method based on a large model provided in an embodiment of the present application; Figure 2 A schematic diagram of the structure of word vector conversion provided in an embodiment of the present application; Figure 3 A flowchart of initializing a vector data table provided in an embodiment of the present application; Figure 4 A schematic diagram of a structure of a database reasoning based on a large model provided in an embodiment of the present application; Figure 5 A schematic diagram of the structure of a database reasoning device based on a large model provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] The following describes some of the techniques involved in the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, some descriptions of well-known functions and structures are omitted in the following description.
[0020] The embodiment of the present application proposes a database reasoning method based on a large model, which obtains and processes a multi-target data set, converts it into a word vector set partition and stores it in a vector data table, calls the large model to reason about the word vector set, builds an index, calculates the search vector similarity, screens out the closest search results, converts them into a database query statement, executes the query statement to obtain the final data query result, and returns it to the user. This method breaks through the limitations of traditional system functions, improves overall flexibility, and reduces dependence on manual operations.
[0021] Figure 1 It is a flowchart of a database reasoning method based on a large model provided in an embodiment of the present application, including steps 101 to 108. Figure 1 This is only an execution order shown in the embodiment of the present application, and does not represent the only execution order of the database reasoning method of the large model. In the case where the final result can be achieved, Figure 1 The steps shown may be performed in parallel or in reverse, as follows.
[0022] Step 101: Preprocess the multi-source dataset to obtain the target dataset. In the present application example, the m3e-base model is used as the embedded large model to preprocess the multi-source dataset, and the preprocessing process is completed with the help of the spelling detector and grammar analyzer provided by the embedded large model, or by applying custom filtering rules.
[0023] Preprocessing includes cleaning the multi-source data set, removing outliers, filling missing values, and correcting erroneous values; and / or removing data that is not related to the target business in the multi-source data set after data cleaning, and verifying the remaining data to obtain the initial data set; and / or lowercase the initial data in the initial data set and remove meaningless characters to obtain the target data set. Among them, meaningless characters include punctuation marks, interjections, conjunctions, prepositions, special characters and other characters that have no actual meaning. In addition, outliers need to be identified before they are removed, which can be identified by drawing box plots or calculating standard deviations.
[0024] Step 102: Segment the target data set and convert it into word vectors to form a word vector set. The structural diagram of word vector conversion is as follows: Figure 2 As shown. In the present application, the target data in the target data set is segmented into word units by a model-specific word segmenter, and markers are added to the word units to mark the relationship between the word units. Exemplarily, the target data is segmented into word units using the BERT model. In the BERT model, a [CLS] tag is added at the beginning of each sentence, a [SEP] tag is added at the end of the sentence, and a [UNK] tag is added to distinguish when an unknown or unrecognizable word is encountered. The unit ID of each word unit is obtained through the vocabulary, and the word unit is filled or truncated to a set length according to the input requirements. In an embodiment of the present application, it is selected to obtain the vocabulary in Bert-base-uncased (a pre-training model for deep learning), and new vocabulary can be added to the vocab.txt file to continuously expand and improve the word vector set to meet the user's search needs.
[0025] For example, the [PAD] tag can be added at the end of the sequence of shorter word units to achieve padding alignment, so that all word units have the same length. Among them, word unit truncation can be achieved through the built-in functions of the database, such as the built-in TRIM() or LEFT() functions in MySQL, and the built-in _TRUNCATE() function in PostgreSQL, which can truncate the word vector to a set length.
[0026] However, whether truncating from the beginning of the text to the position with a limited number of words, or truncating from the end to the beginning, it will cause partial sequence loss and result in a large amount of data loss. Therefore, in the embodiment of the present application, the truncated gradient method is added to help stabilize the training process and solve the gradient disappearance problem. The details are as follows: ; ; In the formula, represents the truncation function, Represents a dimension of the word vector, represents the threshold value, represents the attenuation rate, represents the learning rate, represents partial derivative, Indicates how each dimension of the feature weight is updated, represents regularization, represents the weight, represents the bias, Represents the gravity parameter.
[0027] Considering that the more content is truncated, the greater the error, specifically, CRF (conditional random field) is used to smooth and optimize the word units to ensure the overall consistency of the word units. When processing multiple sentences, the word units of a set length are converted into word vectors and embedded position information and paragraph information are added to ensure that the segmented word vectors can still correctly express the target data. For example, if the target data is text data, the embedded position information and paragraph information can ensure the correct position relationship between sentences, sentences and paragraphs, and paragraphs in the text data to express the meaning of the text data.
[0028] Step 103: partition and store the word vector set based on its source to generate multiple vector data tables, and set a vector table ID for the vector data table. In the embodiment of the present application, the Milvus vector database is used to store the vector data table. In addition, a flowchart for initializing the vector data table is provided, such as Figure 3 As shown. When the program is run for the first time, the Milvus vector database will be automatically initialized, including establishing a connection between the word vector set and the database, obtaining the data information of the word vector set, and creating a data table based on specific business attributes, such as 'chat2db'. The data information includes the unit ID and the vector data type; obtain the form information of the data table in the database; the form information includes the data table name, character set, index information, storage engine, sorting rules and field information, and the field information includes the field name, data type, whether it is NULL, whether it is the primary key and field comments.
[0029] For example, after the data table is created, a database schema containing fields such as "database ID", "data table name", "data table ID", "data table information" and "database name" will be defined. This design strategy is to enable the system to index the original database according to the data source to obtain more business data after matching the target data through vector query, provide basic information for the next step of database query statement generation, and ensure that the generated database query statement type is consistent. Then clean the form information to make it consistent with the data information of the corresponding word data set.
[0030] The word vector set is stored in a data table, and it is partitioned according to the source of the word vector to obtain multiple vector data tables, and the vector table ID is set. Specifically, the partitioning function provided by the Milvus vector database is used to isolate the data, and the data is stored in different partitions according to different data sources, avoiding cross-contamination between data. Concatenate the database name and the corresponding database ID to generate a unique code (for example: 'laoshan_data_14'), and then create a partition of the vector database. For example, the name of the partition is: laoshan_data_14. The database ID is unique under the same operating environment, so the created partition is also unique. Subsequently, according to the Schema format, the word vector data is written to the partition specified by the Milvus vector database (for example: 'laoshan_data_14') to complete the word vector set storage and avoid cross-contamination between data.
[0031] Step 104: Construct a mapping relationship based on the attribute information of multiple vector data tables, and generate a vector service data interface based on the mapping relationship. In an embodiment of the present application, the data model is automatically constructed and the data is formatted using JSON, wherein the mapping relationship is composed of a key-value pair, with a data table as a unit, the key (KEY) is composed of the data table name and comment, and the value (VALUE) describes all the field information in the table in detail. The converted word vectors are temporarily stored in a collection until all data tables complete the word vector conversion and are stored in the data source management platform.
[0032] Step 105: intercept the user's search input before it reaches the server, and call the vector service data interface to convert the search input into a search vector. Figure 4 As shown, a vector service interface is generated based on the mapping relationship, and the user's search request is intercepted before it reaches the server. The user's search input will call the vector service interface to generate a search vector, interact with the data source management platform for query, obtain the basic information of the target data set, and build an index. Through the Milvus vector database, large-scale word vector data can be effectively managed and indexed, thereby improving the speed and accuracy of data retrieval. In order to further improve the retrieval efficiency, according to the needs of specific tasks, HNSW (hierarchical navigation small world) and R-Trees (R tree) type indexes are constructed in the embodiments of the present application to facilitate matching.
[0033] HNSW performs approximate nearest neighbor (ANN) search in high-dimensional space and builds a hierarchical graph structure in the data space to achieve faster search speed.
[0034] Through R-Tree index, a balanced tree structure is designed for spatial data to build an index for two-dimensional or multi-dimensional spatial objects. In the processing of spatiotemporal information business, it is mainly reflected in the map data in the geographic information system (GIS) or the spatial data in the database. Processing spatial data, such as the query of points, lines and polygons in the map, and the retrieval of data related to geographic location.
[0035] Step 106: Obtain a first number of target vector data tables for the search vector matching vector data table. The first number is the K data with the highest similarity. By specifying the query vector table ID, partition name, and data table name, a search query is performed for the K (Top-K) data with the highest similarity. This operation is intended to find the data records that best match the query condition.
[0036] The similarity search of the search vector is actually judged by the distance between the two search vectors in the high-dimensional space, that is, finding the K search vectors closest to the target vector in the high-dimensional space. There are many ways to measure the distance of vector similarity. This application embodiment takes the Euclidean distance as an example, and its calculation formula is as follows: ; In the formula, represents the distance between two search vectors, and represents two search vectors, represents the dimension of the search vector, Indicates the limitation of specific search vectors. In order to find the K search vectors in the set that are most similar to the target vector, it is necessary to calculate the Euclidean distance between the target vector and all the search vectors in the set, and then sort the search vectors according to the distance to obtain the K search vectors with the smallest distance, that is, the K search vectors that are most similar to the target vector. The amount of calculation required for the search is proportional to the size of the set. The larger the size of the search set, the greater the amount of calculation required.
[0037] Step 107: Convert the search vector into a database query statement, and query the first number of target vector data tables through the database query statement; organize the parameters according to the client retrieval interface parameter requirements. Such as: the vector table ID to be queried, the partition name (for example: 'laoshan_data_14'), the data table name, and the first number (ie K) and other parameters. Exemplarily, the first number here, i.e. K, is set to 5. After completing the parameter organization, call the retrieval interface of the Milvus vector database and wait for the return of the Top-K most similar data. Each piece of data includes the form information of the data table, such as: name, code, field name, and comments and types of each field.
[0038] Among them, regarding the setting of K: On the one hand, regarding the accuracy of the target data set hit, the information input by the user is not standardized. Considering the accuracy of the target data table hit in extreme cases, if K is set too small, the target data table may be missed, resulting in inaccurate subsequent results. On the other hand, the longest word unit length supported by the large model: If K is set too large, this setting condition can indeed better improve the hit accuracy of the target table, but the word units that the large model can accept have an upper limit, and it cannot process inference requests without restraint. Therefore, the length of the word unit must meet the requirements of the large model. In order to provide a certain degree of redundancy and include the target data table as much as possible, K is set to 5.
[0039] Step 108: Filter and sort the query results and send them to the user interface. Specifically, make necessary formatting adjustments to the query results, perform data verification, and establish a temporary table loop to take exception capture measures. Return the processed query results to the user interface. Exemplarily, the user inputs: "Help me check how many extra-large debris flow risk points there are in Longchuan County" or "Check how many houses are under the name of user Li Si". The reasoning service will automatically run according to the above process to complete the reasoning of the data table and display the query results.
[0040] Although the present application provides method operation steps such as embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in this embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in the order of the method shown in this embodiment or the accompanying drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).
[0041] like Figure 5 As shown, the embodiment of the present application also provides a large model-based database reasoning device 500. The device includes: a data processing module 501, a storage module 502, a matching module 503, a reasoning module 504, and a retrieval module 505, as follows.
[0042] The data processing module 501 is used to pre-process the multi-source data sets to obtain the target data set; segment the target data set and convert it into word vectors to form a word vector set.
[0043] The storage module 502 is used to partition and store the word vector set based on its source to generate multiple vector data tables, and set a vector table ID for the vector data table.
[0044] The matching module 503 is used to construct a mapping relationship based on the attribute information of multiple vector data tables, and generate a vector service data interface based on the mapping relationship; intercept the user's search input before it reaches the server, and call the vector service data interface to convert the search input into a search vector; match the vector data table for the search vector to obtain a first number of target vector data tables.
[0045] The reasoning module 504 is used to convert the search vector into a database query statement, and query the first number of target vector data tables through the database query statement.
[0046] The search module 505 is used to filter and sort the query results and then send them to the user interface.
[0047] The devices or modules described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described in various modules according to their functions. When implementing this application, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.
[0048] The method, device or module in the present application can be implemented in the form of a computer-readable program code. The controller can be implemented in any appropriate manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (English: Application Specific Integrated Circuit; Abbreviation: ASIC), a programmable logic controller and an embedded microcontroller. Examples of controllers include but are not limited to the following microcontrollers: ARC 625D, AtmelAT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included in it for implementing various functions can also be regarded as structures within the hardware component. Or even, the means for realizing various functions may be regarded as both a software module for realizing the method and a structure within a hardware component.
[0049] An embodiment of the present application also provides a device for a database reasoning method based on a large model, the device comprising: a processor; a memory for storing processor executable instructions; when the processor executes the executable instructions, the method of the embodiment of the present application is implemented.
[0050] The embodiments of the present application also provide a non-volatile computer-readable storage medium on which a computer program or instruction is stored. When the computer program or instruction is executed, the method described in the embodiments of the present application is implemented.
[0051] In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist independently, or two or more modules may be integrated into one module.
[0052] It can be known from the description of the above implementation mode that those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on such an understanding, the technical solution of the present application can be essentially or partly reflected in the prior art in the form of a software product, or it can be reflected in the implementation process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods of each embodiment of the present application or some parts of the embodiments.
[0053] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0054] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present application.
Claims
1. A database reasoning method based on a large model, It is characterized in that include: Preprocessing multiple source data sets to obtain target data sets; Segmenting the target data set and converting it into word vectors to form a word vector set; Based on the source of the word vector set, partition the word vector set to generate multiple vector data tables, and set a vector table ID for the vector data table; Constructing a mapping relationship according to the attribute information of the plurality of vector data tables, and generating a vector service data interface based on the mapping relationship; intercepting the user's search input before it reaches the server, and calling the vector service data interface to convert the search input into a search vector; matching the vector data table for the search vector to obtain a first number of target vector data tables; Converting the search vector into a database query statement, and querying the first number of target vector data tables through the database query statement; The query results are filtered and sorted and sent to the user interface.
2. The method according to claim 1, It is characterized in that The preprocessing of the multi-source data sets to obtain the target data set includes: Perform data cleaning on the multi-source data set to remove outliers, fill in missing values, and correct erroneous values; and / or Removing data irrelevant to the target business from the multi-source data set after data cleaning, and verifying the remaining data to obtain an initial data set; and / or The initial data in the initial data set is converted to lowercase, and meaningless characters therein are removed to obtain a target data set.
3. The method according to claim 1, It is characterized in that The step of segmenting the target data set and converting the target data set into word vectors includes: Segmenting the target data in the target data set into word units, and adding markers to the word units to mark the relationship between the word units; Obtaining the unit ID of each word unit through the vocabulary; Filling or truncating the word unit to a set length according to input requirements; The word unit of the set length is converted into the word vector.
4. The method according to claim 3, It is characterized in that After the target data set is segmented and converted into word vectors, the method further includes: Position information and paragraph information are embedded in the word vector.
5. The method according to claim 1, It is characterized in that The partitioning and storing of the word vector set based on its source to generate multiple vector data tables includes: Establishing a connection between the word vector set and a database, and obtaining data information of the word vector set; wherein the data information includes a unit ID and a vector data type; Obtaining form information of a data table in a database; wherein the form information includes data table name, character set, index information, storage engine, sorting rule and field information, and the field information includes field name, data type and field comment; Cleaning the form information to make it consistent with the data information corresponding to the word vector set; The word vector set is stored in the vector data table, partitioned according to the source of the word vector to obtain a plurality of the vector data tables, and a data table ID and a corresponding database ID are set.
6. The method according to claim 5, It is characterized in that The vector table ID is composed of the data table ID and the corresponding database ID.
7. The method according to claim 1, It is characterized in that Before querying the first number of target vector data tables through the database query statement, the method includes: The partitioned vector data table is stored in a data source management platform, and the vector data table is matched in the data source management platform according to the search vector.
8. A database reasoning device based on a large model, It is characterized in that include: The data processing module is used to preprocess the multi-source data sets to obtain the target data sets; segment the target data sets and convert them into word vectors to form a word vector set; A storage module, used for partitioning and storing the word vector set based on its source to generate multiple vector data tables, and setting a vector table ID for the vector data table; A matching module, configured to construct a mapping relationship according to the attribute information of the plurality of vector data tables, and generate a vector service data interface based on the mapping relationship; intercept the user's search input before it reaches the server, and call the vector service data interface to convert the search input into a search vector; match the vector data table for the search vector to obtain a first number of target vector data tables; An inference module, configured to convert the search vector into a database query statement, and query the first number of target vector data tables through the database query statement; The retrieval module is used to filter and sort the query results and then send them to the user interface.
9. A device for executing a database reasoning method based on a large model, It is characterized in that include: processor; a memory for storing processor-executable instructions; When the processor executes the executable instructions, the method according to any one of claims 1 to 7 is implemented.
10. A non-volatile computer-readable storage medium, It is characterized in that The device comprises a computer program or an instruction for storing the computer program or the instruction, which, when executed, enables the method according to any one of claims 1 to 7 to be implemented.
Citation Information
Cited By
Code library question and answer method and device based on large model
CN121303374A
A large model-based code base question and answer method and device
CN121303374B
