Database schema linking method and apparatus based on sampling optimization

By employing sampling optimization and database schema graph expansion techniques, the problem of insufficient recall in database schema linking is solved, achieving efficient and accurate schema linking, which is applicable to natural language data access scenarios in multiple industries.

CN122152981APending Publication Date: 2026-06-05PEKING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
PEKING UNIV
Filing Date
2026-02-04
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing technologies have insufficient recall in database schema linking, resulting in some database schema elements not being accurately identified and linked, affecting the completeness and accuracy of data queries. At the same time, the methods based on model training and tuning have high requirements for computing resources, which limits the widespread application and deployment of the technology.

Method used

We employ a sampling-optimized database schema linking method, which enhances the database schema and performs noisy inference on the large model. By combining the database schema relationship graph with multiple rounds of expansion, we improve the diversity and recall of the large model output.

Benefits of technology

It significantly improves the recall and accuracy of pattern linking, reduces computational costs, is suitable for resource-constrained environments, and is applicable to data querying, intelligent customer service, business intelligence systems, and data management platforms for non-professional users, thus promoting the popularization of automated pattern linking technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122152981A_ABST
    Figure CN122152981A_ABST
Patent Text Reader

Abstract

The application belongs to the field of information technology and relates to a database schema linking method and device based on sampling optimization. The method comprises the following steps: inputting a database schema and a user question into the context of a large model; obtaining a diversity-enhanced sampling result of the large model through database schema enhancement and noisy inference of the large model; obtaining a database schema linking result according to the diversity-enhanced sampling result of the large model; constructing a database schema relationship graph; and extending the database schema linking result based on the database schema relationship graph. The application effectively improves the overall performance of the database schema linking technology based on the large language model, can significantly improve the recall rate while maintaining a high accuracy, can promote the popularization and development of the automatic schema linking technology in practical applications, and can lay a solid foundation for various downstream tasks such as database question answering and information extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of information technology and artificial intelligence technology, and specifically relates to a database schema linking method and apparatus based on sampling optimization. Background Technology

[0002] A database schema, or simply schema, is the overall design of a database structure. It defines how data is organized in the database, including table names, fields, data types, constraints, and the relationships between them. Database schema linking, or schema linking, is the process of associating user queries with the database structure. It identifies key information such as keywords in the query and maps them to table names, field names, or data values ​​in the database, helping the system understand the user's query intent. Database schema linking is a crucial step in understanding and using database information in natural language question answering systems.

[0003] Large Language Models (LLMs), often shortened to large models, are natural language processing models trained on large-scale text data using deep learning techniques. They are capable of understanding and processing human language and generating text based on user natural language input, supporting various tasks such as question answering, translation, and summarization. LLMs have wide practical value in various language intelligence applications. Sampling refers to the process by which a LLM selects the final output word from multiple predicted possible words when generating text. Through sampling, the model can produce diverse responses while maintaining reasonableness, avoiding the generation of the same content each time.

[0004] In-Context Learning (ICL) is a method that allows large language models to learn how to complete tasks directly by utilizing examples or cues in the input, without changing the model parameters. The model understands the task requirements and example formats based on given contextual information, thereby generating expected output. Contextual learning does not require additional model training; it simply helps the model quickly adapt to new tasks by designing appropriate contextual content.

[0005] Context-based pattern linking technology utilizes a large language model to automatically identify keywords in the user's question within the input context, through examples or hints, and map them to tables, fields, or data values ​​in a database. This method requires no additional model training; it only needs well-designed contextual information to enable the model to understand the question's intent and the database structure, thus achieving accurate pattern matching. Context-based pattern linking can flexibly adapt to different databases and query tasks, improving the accuracy and efficiency of natural language-database interaction. A good pattern linking method should meet the following conditions: given a user question and a complete database schema, it should provide as many database schemas (tables, fields, data values, etc.) as possible that are relevant to the user's question, and as few database schemas (tables, fields, data values, etc.) as possible that are irrelevant to the user's question. Therefore, the evaluation metrics for pattern linking methods mainly include the following two: recall (the proportion of relevant patterns identified out of all relevant patterns) and precision (the proportion of relevant patterns identified out of all identified patterns).

[0006] Sampling optimization techniques refer to adjusting sampling strategies and parameters during text generation using large language models to control the diversity and quality of the output. Sampling optimization does not change the model itself; it only adjusts the selection mechanism during text generation to make the output more aligned with user needs and task objectives. Multiple sampling is a common sampling optimization technique, which involves repeatedly sampling the same input multiple times to obtain several reasonable but distinct outputs, and then integrating these outputs in some way to improve the quality of the final generated result.

[0007] Schema linking, as a crucial step in various downstream tasks such as database question answering and information extraction, bears the heavy responsibility of mapping entities and relations in natural language to database schema elements. Its accuracy directly affects the performance of subsequent tasks. Traditional manual schema linking methods are time-consuming and labor-intensive, require high levels of professional skills, and are difficult to adapt to large-scale and diverse data environments. Therefore, realizing automated schema linking technology has become an inevitable trend to improve the efficiency of data intelligence processing.

[0008] Current context learning methods based on large pre-trained language models have shown great potential in pattern linking tasks, but their recall performance remains unsatisfactory. Insufficient recall leads to the inaccurate identification and linking of some database pattern elements, thus affecting the completeness and accuracy of subsequent steps such as data retrieval. Furthermore, while methods based on model training and tuning can improve the pattern linking capabilities of large models, they have high requirements for data volume and computational resources, limiting the widespread application and deployment of the technology. Summary of the Invention

[0009] To address the above problems, the present invention provides a database schema linking method and apparatus based on sampling optimization.

[0010] The technical solution adopted in this invention is as follows: A database schema linking method based on sampling optimization includes the following steps: Input the database schema and user questions into the context of the large model; By enhancing the database schema and using noisy inference in large models, we obtain sampling results with enhanced diversity in large models. Based on the sampling results enhanced by the diversity of the large model, obtain the database schema linking results.

[0011] Furthermore, the above method also includes the following steps: Construct a database schema diagram; The database schema linking results are expanded based on the database schema relationship diagram.

[0012] Furthermore, the database pattern enhancement includes: when the database pattern is input into the context of the large model, increasing the diversity of the prompt words in the large model by randomly shuffling their order.

[0013] Furthermore, the large model with noisy inference includes: during the large model feedforward process, injecting Gaussian noise into the activation values ​​of a specific layer to perturb the semantics of the input content, thereby enhancing the diversity of the large model output.

[0014] Furthermore, the database schema relation graph consists of a node set and an edge set. The node set is a collection of all fields in the database, and the edge set is a binary relation between any two nodes in the node set, defined based on the existence of semantic similarity.

[0015] Furthermore, the expansion of the database schema linking results based on the database schema relationship graph includes: based on the database schema relationship graph, performing multiple rounds of expansion on the database schema set obtained from the large model reasoning, with each round of expansion adding nodes connected to the nodes in the database schema set selected in the previous round to form a new database schema set.

[0016] A database schema linking device based on sampling optimization, comprising: The input module is used to input the database schema and user questions into the context of the large model; The diversity enhancement module is used to obtain the sampling results of large model diversity enhancement through database pattern enhancement and noisy inference of large models; The database schema linking result acquisition module is used to obtain database schema linking results based on the sampling results enhanced by the diversity of large models.

[0017] Furthermore, the aforementioned device also includes: The database schema diagram construction module is used to construct database schema diagrams. The schema extension module is used to extend the database schema linking results based on the database schema relationship diagram.

[0018] The present invention also provides a computer device including a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing steps of the method of the present invention.

[0019] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a computer, implements the steps of the method of the present invention.

[0020] The beneficial effects of this invention are as follows: This invention eliminates the need for fine-tuning or retraining large pre-trained language models. By optimizing the sampling strategy, it significantly improves recall during pattern linking while maintaining high accuracy. This lightweight solution effectively reduces computational costs and data dependencies, meeting the demand for efficient and accurate pattern linking in resource-constrained environments and promoting the widespread adoption and development of automated pattern linking technology in practical applications. This invention achieves significant performance improvements with extremely low computational overhead, making it highly deployable and suitable for resource-constrained real-world applications. Furthermore, this solution is universally applicable to various base models and can be seamlessly integrated with model-based fine-tuning techniques and other pattern linking optimization techniques for even better results.

[0021] The technical solution of this invention effectively improves the overall performance of database schema linking technology based on large language models, significantly increasing recall while maintaining high accuracy. This invention can promote the popularization and development of automated schema linking technology in practical applications and lay a solid foundation for various downstream tasks such as database question answering and information extraction. Attached Figure Description

[0022] Figure 1 This is a flowchart of the steps of a database schema linking method based on sampling optimization according to an embodiment of the present invention.

[0023] Figure 2 This is a schematic diagram of the large model reasoning process with enhanced diversity.

[0024] Figure 3 This is a flowchart of the steps of a database schema linking method based on sampling optimization according to another embodiment of the present invention.

[0025] Figure 4This is a schematic diagram illustrating the use of a relational graph-based database schema extension technique on top of the large model reasoning technique that enhances diversity.

[0026] Figure 5 It is a schema extension flowchart based on a relational graph.

[0027] Figure 6 This is a graph showing the case-level recall results for large-scale inference with enhanced diversity.

[0028] Figure 7 This is a graph showing the accuracy results of large model inference with enhanced diversity.

[0029] Figure 8 This is a case-level recall result graph based on relational graph-based pattern expansion, built upon large-scale model reasoning with enhanced diversity.

[0030] Figure 9 This is an accuracy result graph based on relational graph-based pattern expansion, built upon large-scale model reasoning with enhanced diversity.

[0031] Figure 10 This is a structural block diagram of a database schema linking device based on sampling optimization according to an embodiment of the present invention.

[0032] Figure 11 This is a structural block diagram of a database schema linking device based on sampling optimization according to another embodiment of the present invention. Detailed Implementation

[0033] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings.

[0034] The sampling-optimized database schema linking method of the present invention includes two main components: large model inference with enhanced diversity and schema expansion based on relational graphs.

[0035] To leverage the contextual learning and reasoning capabilities of large language models for database schema linking tasks, the simplest and most direct approach is to place the database schema and user question within the context of the large model, forming a single prompt word. The large model then performs a single text generation (sampling) and extracts the schema linking results from the generated text. However, the recall rate of a single inference by the large model is often too low, easily missing some tables, fields, or data values ​​related to the user question. Existing work has found that randomly sampling multiple times for a single prompt word and taking the union of the schema sets obtained from each sampling can effectively improve the recall rate of schema linking. However, relying solely on multiple sampling results in insufficient output diversity of the large model, causing two problems: 1) The recall rate is low when improved through multiple sampling. Due to the lack of diversity in the sampled results, even with infinitely many samplings, the union of the results still results in insufficient recall. Due to flaws in the prompt word design or the characteristics of the large model itself, some tables, fields, or data values ​​are consistently difficult to sample. 2) The sampling efficiency is too low. Due to the lack of diversity in the sampled results, a large number of repeated samplings are often required to effectively improve the recall rate. This significantly increases the time and storage overhead of schema linking.

[0036] To address the aforementioned problems, one embodiment of the present invention proposes a database schema linking method based on sampling optimization, employing a large model inference technique with enhanced diversity. The process is as follows: Figure 1 As shown, it includes the following steps: Step S11: Input the database schema and user question into the context of the large model; Step S12: Obtain the sampling results of the large model with enhanced diversity through database pattern enhancement and noisy inference of the large model; Step S13: Obtain the database schema linking results based on the sampling results enhanced by the diversity of the large model.

[0037] In one embodiment of the present invention, step S12 enhances the diversity of large model sampling results in two ways, thereby improving sampling efficiency and recall ceiling: Step S121: Database schema enhancement (hard enhancement): When the database schema (table, field, data value) is input into the large model context, its order is randomly shuffled, thereby enhancing the diversity of the large model's prompt words.

[0038] Step S122: Large Model Inference with Noise (Soft Augmentation): During the large model feedforward process, Gaussian noise is injected into the activation values ​​of specific layers of the model to perturb the semantics of the input content, thereby enhancing the diversity of the model output. To ensure that the large model knows the correct table names, field names, data values, etc., the noise is only injected into the activation values ​​corresponding to tokens (lexicons, which are the smallest units into which the large model divides language) outside the database schema.

[0039] Figure 2 This diagram illustrates how the two methods described above enhance the diversity of large-scale model inference. Compared to simple repeated sampling, these techniques effectively improve the diversity of large-scale model outputs.

[0040] In one embodiment of the present invention, step S13 is to extract pattern linking results from the diversity-enhanced sampling results using a large model.

[0041] The aforementioned large-model inference techniques that enhance diversity can significantly improve recall while maintaining high pattern linking accuracy. However, as the number of samples increases, the marginal benefit of further increasing the number of samples will gradually decrease, making the trade-off between inference cost and performance improvement a crucial issue.

[0042] Therefore, in one embodiment of the present invention, a database schema linking method based on sampling optimization is provided, such as... Figure 3 As shown, based on steps S11, S12, and S13, the following steps are also included: Step S14: Construct the database schema diagram; Step S15: Expand the database schema linking results based on the database schema relationship diagram.

[0043] The above method employs a database schema extension technique based on relational graphs. Building upon the diversity-enhancing large-model inference technique, it further improves recall with lower computational overhead. Figure 4 As shown, this technique treats each column (field) in the database as a "node" in a graph, with "edges" existing between semantically similar fields. During pattern linking, it first uses a large model inference technique with enhanced diversity to select certain nodes in the graph, and then includes nodes connected to these nodes by edges in the resulting pattern linking set. The basic idea is that if a field is considered relevant to the user's problem by the large model, then other similar fields are also highly likely to be relevant to the user's problem.

[0044] In one embodiment of the present invention, step S14 includes: Define the relationship diagram From node set and edge set composition: Among them, node set It is a collection of all fields in the database, where each field is in the form of Table.Column, that is, a column in a certain table. in, This represents the set consisting of all data tables. Represents a set In the table named Table, Table is a variable representing the "table name", and Column is a variable representing the "column name".

[0045] The edge set is defined on the node set. Binary relations on: in, Representing two nodes There is semantic similarity between them. Semantic similarity can be measured in various ways, and common metrics include: a) Edit Distance. Edit distance is a way to measure the difference between two strings, representing the minimum number of editing operations required to transform one string into another. Common editing operations include inserting a character, deleting a character, and replacing a character. The smaller the edit distance, the more similar the two strings are. The most commonly used edit distance is the Levenshtein distance, which is the minimum total number of the above three operations.

[0046] b) Vector Similarity. Vector similarity is a method used to measure how semantically similar two texts are. The basic idea is to first convert the text into vectors (i.e., a set of numbers), and then calculate the similarity between these vectors. Commonly used vector similarity calculation methods include cosine similarity, Euclidean distance, and normalized dot product. In natural language processing, text vectors are usually generated by word embeddings (such as Word2Vec, BERT, etc.). Compared to edit distance, vector similarity better measures the semantic similarity between texts, rather than literal similarity.

[0047] c) Large language model inference. Large models possess strong semantic understanding and reasoning capabilities, and can consider the entire database schema as context, thus enabling them to better determine the relevance between two fields. In contrast, vector similarity can only compare the semantic similarity of two field names in isolation, lacking an understanding of the global semantics. However, the overhead of large model inference is significantly higher than calculating edit distance and vector similarity.

[0048] In one embodiment of the present invention, step S15 includes: based on the above-mentioned pattern relationship diagram, performing multiple rounds of expansion on the pattern set obtained by large model reasoning, wherein each round of expansion will expand the pattern set selected in the previous round. Based on this, add fields that are connected to the existing fields by edges to form a new pattern set. : in, Represents nodes Nodes are connected by edges. Each round of expansion increases recall but decreases precision to some extent. In practical applications, the number of expansion rounds can be flexibly selected according to needs to achieve a reasonable trade-off between recall and precision. The complete process of schema expansion based on the relationship graph is as follows: Figure 5 As shown.

[0049] The main content of this invention is to improve the performance of pattern linking in large language models through sampling optimization, mainly including the following three key technical points: 1) This invention proposes a method to improve pattern linking performance by enhancing the diversity of reasoning in large models (steps S1, S2, S3). 2) This invention proposes a method for constructing a database schema relation graph (step S4). 3) This invention proposes a method for extending the pattern linking results based on the database schema relation graph (step S5).

[0050] We conducted experiments on the DEV subset of the BIRD dataset using GLM-4-chat-9B (an open-source large language model) as the base model. This dataset can be used to evaluate the performance of large language models on schema linking tasks. Specifically, each data point in this dataset contains the following: 1) A query request expressed in natural language; 2) A complete database schema, denoted as ; 3) A subset of the schema (specific tables and columns) relevant to a given request. This subset of the schema is expert-annotated to ensure its correctness. This subset of the schema is denoted as... .

[0051] The large language model needs to select patterns relevant to a given request from all patterns based on 1) and 2). The subset of patterns selected by the large language model is denoted as . By comparing the patterns selected by the large language model with the correctly labeled patterns in the dataset, the performance of the technique used on the pattern linking task can be evaluated. The evaluation metrics mainly include the following three: 1) Precision. This indicates the proportion of patterns selected by the method of this invention that are truly relevant. The formula for calculating precision is as follows: 2) Pattern-level recall. This indicates the proportion of truly relevant patterns captured by the method of this invention. The formula for calculating pattern-level recall is as follows: 3) Case-level recall. In the dataset containing all N data points (each data point being a case), what proportion of cases can the method of this invention achieve a pattern-level recall rate of 100%?

[0052] in, Represents a set The number of elements in the set is the size of the set.

[0053] Generally, methods with higher accuracy tend to have lower recall. It's important to note that in pattern linking tasks, case-level recall is the most critical metric. This is because for any given case, if even one related pattern fails to be successfully recalled, subsequent tasks may fail due to missing necessary information. Therefore, sacrificing a small amount of accuracy to improve case-level recall is generally considered worthwhile.

[0054] First, we present the experimental results of "diversity-enhanced large model inference" to demonstrate the effectiveness of this technique. This part of the experimental data is as follows: Figure 6 , Figure 7 As shown in the figure. The horizontal axis represents the number of repeated samples; Figure 6 The vertical axis represents the case-level recall rate; Figure 7 The vertical axis represents the accuracy rate. Figure 6 , Figure 7The five lines represent different diversity enhancement methods. "Shuffle," or "database schema enhancement," randomly shuffles the order of database schemas (tables, fields, data values) when inputting them into the large model context, thereby enhancing the diversity of prompts in the large model. "Full noise / Fine noise," or "large model inference with noise," injects Gaussian noise into the activation values ​​of specific layers in the large model during the feedforward process, perturbing the semantics of the input content and thus enhancing the diversity of the model output. "Full" and "fine" represent the specific methods of noise injection; the former injects noise into all input tokens, while the latter injects noise only into a subset of tokens. Analyzing the above data, it can be seen that the case-level recall significantly improves with increasing resampling frequency. By using the proposed technique (diversity-enhanced large model inference), combining database schema enhancement and large model inference with noise, the case-level recall can be further improved. In contrast, the accuracy only slightly decreases with increasing resampling frequency, remaining within an acceptable range.

[0055] Building upon the "diversity-enhanced large-model reasoning" technique, this paper explains the beneficial effects of relational graph-based schema expansion techniques. First, it is necessary to define the semantic similarity between database schemas. This is to construct a relationship diagram. For ease of implementation, define any two columns (fields). The condition for semantic similarity is that the name of one column (field) contains the name of another column (field). In practice, this is a very strict condition. Furthermore, there are special fields in the database, such as primary keys, foreign keys, and important fields discovered through value retrieval (value match). It is specifically stipulated that these special fields are correlated with all other fields. Based on this rule, a relationship graph is constructed for the complete database schema. First, an initial set of schemas is predicted using "diversity-enhanced large model inference". Then, an expansion is performed on the aforementioned relationship graph to obtain the final pattern linking results. The main experimental results are as follows: Figure 8 , Figure 9 As shown in the figure. The horizontal axis represents the number of repeated samples; Figure 8 The vertical axis represents the case-level recall rate; Figure 9The vertical axis represents accuracy. The line labeled "LLM" represents the result without graph-based pattern expansion; the line labeled "LLM+primary key+foreign key+value match+expand" represents the result after one round of pattern expansion based on the graph defined above. It can be seen that graph-based pattern expansion significantly improves case-level recall, achieving over 90% recall with only five resampling attempts, reaching a leading level in the field. Meanwhile, when using graph-based pattern expansion, the decrease in accuracy with increasing resampling attempts is within an acceptable range.

[0056] The sampling-optimized database schema linking method and apparatus proposed in this invention can significantly improve the correlation between natural language queries and database structures. It is particularly suitable for users lacking database knowledge or the ability to write professional query languages ​​(such as SQL), enabling them to complete data retrieval, analysis, and interaction in a natural language manner. In practical applications, this invention can be widely used in the following scenarios: 1) Data query scenarios for non-professional users. In many practical business operations such as enterprise operations, government services, medical management, and education statistics, many staff members need to access information from databases but lack professional skills such as SQL. This invention can automatically convert users' query requirements described in natural language into database-related schema elements, assisting in subsequent query generation. This allows users to complete structured data retrieval without learning complex data query languages. For example, a user only needs to enter "retrieve the contact information of all newly added customers this year," and the system can automatically identify the relevant tables and fields to complete the subsequent data retrieval.

[0057] 2) Data Access Scenarios for Intelligent Customer Service and Question-Answer Systems. In scenarios such as intelligent customer service, government Q&A, and enterprise knowledge base Q&A, the system needs to extract structured information from the database in real time to answer user questions. Traditional methods often rely on manually written rules or templates, which are difficult to update and have limited coverage. This invention can automatically identify the corresponding database pattern based on natural language questions, significantly improving the question-answering system's ability to understand structured data and enabling the system to "ask questions to the database in natural language," thereby significantly improving the automation and accuracy of the question-answering system.

[0058] 3) Natural Language Interaction Scenarios in Business Intelligence (BI) Systems. In typical BI systems, users often need to filter, analyze, and visualize complex data, but the user interface is often quite technical. This invention allows users to directly describe their analytical needs using natural language, such as "show the five categories of products with the highest sales over the past three months." The system can automatically identify the relevant fields and table structures, and combine them with other modules to generate actual query and visualization results, making the BI system easier for non-technical users to use.

[0059] 4) Assisted Modeling and Data Exploration in Data Management Platforms. During data warehouse construction, data governance, or table structure analysis, developers or business analysts frequently need to explore data structures. This invention can help quickly locate relevant tables and fields based on natural language descriptions. For example, if a user inputs "What fields are related to user behavior analysis?", the system can automatically provide a set of potentially relevant patterns in the database, accelerating data exploration efficiency and reducing comprehension costs.

[0060] In summary, this invention enables users to directly submit data query requests using natural language without requiring specialized database knowledge, significantly lowering the barrier to database access and improving data interaction efficiency. This technology has broad application needs and commercial value, and can promote the development and widespread adoption of natural language data access capabilities across multiple industries.

[0061] Another embodiment of the present invention provides a database schema linking device based on sampling optimization, such as... Figure 10 As shown, the device 20 includes: Input module 21 is used to input the database schema and user questions into the context of the large model; Diversity enhancement module 22 is used to obtain the sampling results of diversity enhancement of large models through database pattern enhancement and noisy inference of large models; The database schema linking result acquisition module 23 is used to acquire database schema linking results based on the sampling results enhanced by the diversity of the large model.

[0062] Another embodiment of the present invention provides a database schema linking device based on sampling optimization, such as... Figure 11 As shown, the device 30 includes: Input module 31 is used to input the database schema and user questions into the context of the large model; The diversity enhancement module 32 is used to obtain the sampling results of the diversity enhancement of the large model through database pattern enhancement and noisy inference of the large model; The database schema linking result acquisition module 33 is used to acquire database schema linking results based on the sampling results enhanced by the diversity of the large model.

[0063] Database schema diagram construction module 34 is used to construct database schema diagrams. The schema extension module 35 is used to extend the database schema linking results based on the database schema relationship diagram.

[0064] The above division of modules is merely illustrative. In practical applications, the functions described above can be assigned to different functional modules as needed to complete all or part of the functions described in the aforementioned method. The specific working process of each module can be found in the corresponding process in the aforementioned method embodiments, and will not be repeated here.

[0065] Those skilled in the art will recognize that the method steps and modules described in conjunction with the embodiments disclosed herein can be implemented in computer software, hardware, or a combination of computer software and hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0066] Another embodiment of the present invention provides a computer device (computer, server, smartphone, etc.) including a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing steps of the method of the present invention.

[0067] Another embodiment of the present invention provides a computer-readable storage medium (such as ROM / RAM, disk, optical disk) that stores a computer program, which, when executed by a computer, implements the steps of the method of the present invention.

[0068] Another embodiment of the present invention provides a computer program product, the computer program product including a computer program, which, when executed by a computer, implements the steps of the method of the present invention.

[0069] The specific embodiments of the present invention disclosed above are intended to help understand the content of the present invention and to implement it accordingly. Those skilled in the art will understand that various substitutions, changes, and modifications are possible without departing from the spirit and scope of the present invention. The present invention should not be limited to the content disclosed in the embodiments of this specification; the scope of protection of the present invention is defined by the claims.

Claims

1. A database schema linking method based on sampling optimization, characterized in that, Includes the following steps: Input the database schema and user questions into the context of the large model; By enhancing the database schema and using noisy inference in large models, we obtain sampling results with enhanced diversity in large models. Based on the sampling results enhanced by the diversity of the large model, obtain the database schema linking results.

2. The method according to claim 1, characterized in that, It also includes the following steps: Construct a database schema diagram; The database schema linking results are expanded based on the database schema relationship diagram.

3. The method according to claim 1 or 2, characterized in that, The database pattern enhancement includes: when the database pattern is input into the context of the large model, the diversity of the prompt words in the large model is enhanced by randomly shuffling their order.

4. The method according to claim 1 or 2, characterized in that, The large model with noisy inference includes: during the large model feedforward process, injecting Gaussian noise into the activation values ​​of specific layers to perturb the semantics of the input content, thereby enhancing the diversity of the large model output.

5. The method according to claim 2, characterized in that, The database schema relationship graph consists of a node set and an edge set. The node set is a collection of all fields in the database, and the edge set is a binary relationship between any two nodes in the node set, defined based on whether semantic similarity exists.

6. The method according to claim 2, characterized in that, The expansion of the database schema linking results based on the database schema relationship graph includes: based on the database schema relationship graph, performing multiple rounds of expansion on the database schema set obtained from the large model inference. Each round of expansion adds nodes that are connected to the nodes in the database schema set selected in the previous round, forming a new database schema set.

7. A database schema linking device based on sampling optimization, characterized in that, include: The input module is used to input the database schema and user questions into the context of the large model; The diversity enhancement module is used to obtain the sampling results of large model diversity enhancement through database pattern enhancement and noisy inference of large models; The database schema linking result acquisition module is used to obtain database schema linking results based on the sampling results enhanced by the diversity of the large model.

8. The apparatus according to claim 7, characterized in that, Also includes: The database schema diagram construction module is used to construct database schema diagrams. The schema extension module is used to extend the database schema linking results based on the database schema relationship diagram.

9. A computer device, characterized in that, It includes a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program including instructions for performing the method of any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a computer, implements the method according to any one of claims 1 to 6.