Database parameter tuning method based on expert guidance of multiple large language models
By building an expert system and combining genetic algorithms and deep reinforcement learning models, the problem of low database parameter tuning efficiency in the existing technology is solved, and faster and more efficient database performance optimization is achieved.
Patent Information
- Application Number
- CN202510110055.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-27
AI Technical Summary
Existing database parameter tuning methods are difficult to find the optimal configuration in high-dimensional, heterogeneous and interconnected configuration spaces, and are difficult to dynamically adjust to adapt to different hardware environments and variable workloads, resulting in low tuning efficiency and waste of resources.
The database parameter tuning method based on expert guidance based on the expert's guide is adopted. By constructing an expert system, an RRAG algorithm is used to process documents, hierarchical indexes and abstracts are generated, and a genetic algorithm and deep reinforcement learning model (such as λ-DDPG) is combined with a differentiated algorithm (such as λ-DDPG) to optimize database parameter configuration.
It significantly accelerates the database parameter tuning process, improves the tuning efficiency, and can find the optimal configuration faster, especially in complex environments and dynamic loads, effectively improving database performance.
Smart Images

Figure CN120045635A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database optimization, and particularly to a method for tuning database parameters guided by a multi-large language model expert. Background Art
[0002] In the field of database optimization, with the continuous growth of data volume and the increasing complexity of business requirements, the performance optimization of database management systems (DBMS) has become a key issue. Database performance directly affects the efficiency and quality of data processing, and database parameter tuning is one of the core technologies for optimizing database performance.
[0003] The existing database parameter tuning methods are generally described as the following process: 1. First, determine the key knobs that have a great impact on performance and are applicable to different scenarios from numerous database knobs.
[0004] 2. Determine the appropriate tuning features of the current database, and clarify the workload features (query, concurrency, access data features) and database metrics (tuning objectives, runtime, table statistics metrics).
[0005] 3. According to the characteristics of the database to be optimized currently, use appropriate hyperparameter tuning methods to adjust the database parameters.
[0006] 4. Apply the adjusted parameters to the current database, execute the workload, and collect metrics to guide subsequent tuning operations.
[0007] However, the above implementation process has the following disadvantages: 1. In terms of the configuration space, its high dimensionality, heterogeneity, and interconnectivity make it extremely complex to find the optimal configuration. Numerous parameters are interrelated and intertwined with different natures, greatly increasing the difficulty of optimization.
[0008] 2. In terms of adaptability, it is difficult to dynamically adjust for different hardware environments and changing workloads, and it cannot fully adapt to hardware differences and workload changes.
[0009] 3. Existing tuning methods such as Bayesian optimization and reinforcement learning have problems such as iterative time consumption and cold start respectively, and overall lack of effective utilization of domain knowledge, resulting in low tuning efficiency and serious resource waste, and it is difficult to efficiently meet the database performance optimization requirements. Summary of the Invention
[0010] In view of the above technical problems, the present invention provides a method for tuning database parameters guided by a multi-large language model expert.
[0011] The present invention is implemented by the following technical solutions: A method for tuning database parameters guided by a multi-large language model expert, comprising the following steps: Step S1: Build an expert system, use the RRAG algorithm to process documents to build a hierarchical index and save the summary, perform hybrid retrieval to obtain knowledge, and generate samples for integration according to the tuning stage processing knobs; Step S2: The sample workshop operation is based on the genetic algorithm GA. Initialize the population with specific values, evaluate using a fitness function that combines throughput and latency, select individuals according to the adaptive survival principle, and then hybridize and change elements probabilistically to generate high-quality samples; Step S3: Store the samples generated by the genetic algorithm GA. The samples contain index, configuration, and performance information, provide metrics for the search space optimizer, and assist in the warm start of the deep reinforcement learning model; Step S4: The search space optimizer classifies and compresses the metrics in the memory pool to reduce the dimension, obtains the genetic algorithm sample change metrics, and combines expert knowledge to form a complete knob list; Step S5: Adopt the optimized DDPG algorithm λ-DDPG, consider multiple factors, and improve the stability of reinforcement learning through delayed update and soft update strategies to recommend the best configuration.
[0012] Specifically, the step S1 specifically includes the following sub-steps: Step S11: Use the remix retrieval enhanced generation RRAG algorithm. First, index the database tuning documents, divide them into blocks by chapter and content, build a hierarchical index, extract elements to generate a summary, and store it in the vector database; Step S12: Adopt a hybrid retrieval method that combines vector retrieval, keyword retrieval, and the approximate BM25 algorithm to obtain knowledge; Step S13: In the generation stage, filter, summarize, and transform the knowledge, generate samples according to the tuning stage processing of different-level knobs, and integrate relevant knobs.
[0013] Specifically, the construction of the hierarchical index in the step S11 specifically includes: Divide the database tuning documents by chapter and then by content, focusing on the knowledge of a single knob; Construct a summary tree according to the manual table of contents structure, with the document title as the root node, subsequent nodes representing the subdivided parts of the document, and each sub-node containing the content of the parent chapter and the chapter summary generated by the large language model LLM.
[0014] Specifically, the step S1 generates sample integration by processing the tuning source information through the large language model for the tuning knobs, specifically including: Filter the obtained knowledge; Summarize the filtered knowledge. The large language model LLM summarizes all relevant information according to the designed prompt template; Convert knowledge into JSON format. When processing different types of knobs at different stages, utilize the text analysis ability of the large language model (LLM) to extract relevant information according to specific circumstances.
[0015] Specifically, the steps for generating high-quality samples in step S2 include the following steps: Step S21: Establish an initial population containing n samples according to the genetic algorithm (GA) theory; among them, Adopt the default knob values provided by the database provider, Adopt the system-level and query-level knob recommended values recommended by the expert system, to Be evenly distributed within the default value range recommended by the expert system; Step S22: Evaluate the quality of individual database configurations by combining throughput and latency into a fitness function. The fitness function is: ; Where , , respectively represent the throughput under the current, default, and recommended configurations, , , respectively represent the latency under the current, default, and recommended configurations, and are hyperparameters for controlling the weights of throughput and latency; Step S23: The genetic algorithm (GA) selects individuals according to the adaptive survival principle. The higher the individual fitness, the greater the probability of being selected. The selection probability formula is: ; Step S24: Select and through the selection strategy, and hybridize some of their values to generate new individuals ; Step S25: The genetic algorithm (GA) changes the value of each element within the range recommended by the expert system with a certain probability to generate new individuals , exploring the search space.
[0016] Specifically, step S4 specifically includes the following steps: Step S41: Use the large language model (LLM) as a classifier, classify the metrics in the memory pool into multiple different groups through the RRAG technology, identify the metrics with the most significant change rate compared to the default value among different expert-related metrics, and incorporate them into the prompts of the corresponding experts to obtain knowledge of optimized knobs; Step S42: Use the Factor Analysis (FA) algorithm for metric compression. Find the main direction of the data through eigenvalue decomposition, compress the high-dimensional data into a low-dimensional space, and retain the main features at the same time. Step S43: Obtain the metrics with the largest changes in the best-performance samples in the genetic algorithm stage compared to the default samples. Obtain the knob knowledge at the workload level and knob level according to the recommendations of the expert system, and merge it with the genetic algorithm knobs to obtain a complete knob list.
[0017] Specifically, the optimized DDPG algorithm λ-DDPG in step S5 constructs a reinforcement learning framework with multiple elements, allowing the recommender to select actions according to the database state and optimize the policy to improve performance. The optimized DDPG algorithm consists of two neural networks, specifically: DDPG - Actor learns and generates action policies, and DDPG - Critic learns the evaluation function based on the recommended actions. , and evaluate the quality of the policy.
[0018] Specifically, the elements of the optimized DDPG algorithm include: Agent: It is a DDPG model that determines the policy and recommends actions according to the environmental reward and state, and learns the policy function through a neural network. , maps the state s to the action a, and the weight is ; Environment: It is the database to be tuned cloned by the controller. State: It is the current state representation of the database collected by the metric collector in the controller, and is compressed by the FA algorithm before being input into the agent. Action: It contains the database configuration with the selected top k knob values. Reward: It describes the gap between the performance generated by the current action and the default performance.
[0019] The beneficial effects of the present invention are as follows: The present invention proposes a database parameter tuning method based on multi-large language model expert guidance, which applies multi-large language model experts in the parameter tuning field for the first time and has a significant effect on accelerating parameter tuning. First, it proposes a remix retrieval-enhanced generation framework to effectively collect and refine domain knowledge, form a multi-LLMs expert system, and fully utilize the knowledge for tuning; second, it designs a coarse-to-fine tuning framework, combining GA coarse-grained tuning preheating and λ-DDPG fine-grained tuning to accelerate model convergence and improve tuning efficiency. Considering system and query-level knowledge as well as workload and knob-level knowledge comprehensively, it optimizes the search space, reduces exploration, and finds the optimal configuration faster. By delaying the update strategy, it reduces the training time of the deep reinforcement learning model, improves the overall efficiency of the tuning process, effectively improves the database performance, especially with obvious advantages in complex environments and dynamic loads. Description of the Drawings
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.
[0021] Figure 1 This is the flowchart of database parameter tuning guided by an expert for the multi-large language model of the present invention; Figure 2 This is the architecture diagram of the database parameter tuning method in the embodiment of the present invention; Figure 3 This is the schematic diagram of the design of RRAG in the embodiment of the present invention. Detailed implementation manners
[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Usually, the components of the embodiments of the present invention described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations.
[0023] It should be noted that similar reference numerals and letters indicate similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0024] The following combines the attached Figures 1 - 3 , and details some implementation manners of the present invention. Without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0025] The present invention proposes a database parameter tuning method guided by an expert for the multi-large language model. In a preferred embodiment, as Figure 1 shown, the database parameter tuning includes the following steps: Step S1: Build an expert system, use the RRAG algorithm to process documents to build a hierarchical index to save the abstract, perform hybrid retrieval to obtain knowledge, and generate a sample integration according to the tuning stage to process the knobs; Step S2: The sample workshop operation is based on the genetic algorithm GA. Initialize the population with specific values, evaluate using a fitness function that combines throughput and latency, select individuals according to the adaptive survival principle, and then hybridize and change elements according to probability to generate high-quality samples; Step S3: Store the samples generated by the genetic algorithm GA. The samples contain index, configuration, and performance information, provide indicators for the search space optimizer, and help the deep reinforcement learning model to warm start; Step S4: The search space optimizer classifies and compresses the memory pool metrics to reduce the dimensionality, obtains the genetic algorithm sample change metrics, and combines expert knowledge to form a complete knob list; Step S5: Use the optimized DDPG algorithm λ-DDPG, consider multiple factors, and improve the stability of reinforcement learning through delayed update and soft update strategies to recommend the best configuration.
[0026] In this embodiment, step S1 specifically includes the following sub-steps: Step S11: Use the remix retrieval enhanced generation RRAG algorithm to first optimize the database tuning documents for indexing, divide them into blocks by chapter and content, and construct a hierarchical index, extract elements to generate summaries and store them in the vector database; Step S12: Adopt a hybrid retrieval method that combines vector retrieval, keyword retrieval, and the approximate BM25 algorithm to obtain knowledge; Step S13: In the generation stage, filter, summarize, and transform the knowledge, generate samples according to the tuning stage for different levels of knobs, and integrate relevant knobs.
[0027] In this embodiment, constructing a hierarchical index specifically includes: Divide the database tuning documents by chapter and then by content, focusing on the knowledge of a single knob; Construct a summary tree according to the manual table of contents structure, with the document title as the root node, subsequent nodes representing the subdivided parts of the document, and each child node containing the content of the parent chapter and the chapter summary generated by the large language model LLM.
[0028] In this embodiment, integrating the generated samples by processing the knob according to the tuning stage processes the tuning source information through the large language model, specifically including: Filter the obtained knowledge; Summarize the filtered knowledge, and the large language model LLM summarizes all relevant information according to the designed prompt template; Convert the knowledge into JSON format, and use the text analysis ability of the large language model LLM to extract relevant information according to the specific situation when processing different types of knobs at different stages.
[0029] In this embodiment, step S2 for generating high-quality samples includes the following steps: Step S21: Establish an initial population according to the genetic algorithm GA theory, including n samples; where Adopt the default knob values provided by the database provider, Adopt the system-level and query-level knob recommended values recommended by the expert system, to Be evenly distributed within the default value range recommended by the expert system; Step S22: Evaluate the quality of individual database configurations by combining throughput and latency into a fitness function, where the fitness function is: ; where , , represent the throughput under the current, default, and recommended configurations respectively, , , represent the latency under the current, default, and recommended configurations respectively, and are hyperparameters that control the weights of throughput and latency; Step S23: The genetic algorithm GA selects individuals according to the adaptive survival principle. The higher the individual fitness, the greater the probability of being selected. The selection probability formula is: ; Step S24: Select and through a selection strategy, and hybridize some of their values to generate a new individual ; Step S25: The genetic algorithm GA changes the value of each element within the range recommended by the expert system with a certain probability to generate a new individual , exploring the search space.
[0030] In this embodiment, step S4 specifically includes the following steps: Step S41: Use the large language model LLM as a classifier, and classify the metrics in the memory pool into multiple different groups through the RRAG technology. Identify the metrics with the most significant change rate compared to the default value among different expert-related metrics, and incorporate them into the prompts of the corresponding experts to obtain knowledge of optimization knobs; Step S42: Adopt the factor analysis FA algorithm for metric compression. Find the main direction of the data through eigenvalue decomposition, compress the high-dimensional data into a low-dimensional space while retaining the main features; Step S43: Obtain the metrics with the largest change compared to the default sample in the best-performance samples in the genetic algorithm stage, obtain the knob knowledge at the workload level and knob level according to the recommendations of the expert system, and merge them with the genetic algorithm knobs to obtain a complete knob list.
[0031] In this embodiment, the optimized DDPG algorithm λ-DDPG in step S5 constructs a multi-factor reinforcement learning framework, enabling the recommender to select actions based on the database state and optimize the strategy to improve performance; the optimized DDPG algorithm consists of two neural networks, specifically: DDPG - Actor learns and generates action strategies, and DDPG - Critic learns an evaluation function based on the recommended actions , evaluate the quality of the evaluation strategy. The elements of the optimized DDPG algorithm include: Agent: It is a DDPG model that determines the strategy and recommends actions based on the environmental reward and state, and learns the policy function through a neural network , map the state s to the action a, with the weight being ; Environment: It is the database to be tuned cloned by the controller; State: It is the current state representation of the database collected by the metric collector in the controller, and is compressed by the FA algorithm before being input into the agent; Action: It includes the database configuration containing the selected top k knob values; Reward: It describes the gap between the performance generated by the current action and the default performance.
[0032] In one embodiment, the implementation process of the database parameter tuning method guided by a large language model expert specifically adopts the following steps: S1. Build an expert system, use the RRAG algorithm to process the document to build an index and store the summary, retrieve knowledge through hybrid retrieval, and process the knobs according to the tuning stage to generate and integrate samples.
[0033] S2. The sample workshop operation is based on the genetic algorithm (GA). Initialize the population with specific values, evaluate using a fitness function that combines throughput and latency, select individuals according to the adaptive survival principle, and then hybridize and change elements probabilistically to generate high-quality samples.
[0034] S3. Store the samples generated by GA. The samples contain metrics, configurations, and performance information, provide metrics for the search space optimizer, and help the deep reinforcement learning model to warm start.
[0035] S4. The search space optimizer classifies and compresses the metrics in the memory pool to reduce the dimension, obtains the genetic algorithm sample change metrics, and combines expert knowledge to form a complete knob list.
[0036] S5. Adopt the optimized DDPG algorithm (λ-DDPG), consider factors such as the agent, environment, state, action, reward, and policy, and improve the stability of reinforcement learning through delayed update and soft update strategies to recommend the best configuration.
[0037] Build an expert system, mainly use the RRAG algorithm to process the database tuning documents, build an index and store the summary in the vector database, adopt a hybrid retrieval method to obtain knowledge, and process the knobs according to the tuning stage in the generation stage to generate and integrate relevant knobs. This module mainly includes the following steps: S1.1. Use the remix retrieval augmented generation (RRAG) algorithm to first index the database tuning documents, divide them into blocks by chapter and content, build a hierarchical index, extract elements to generate summaries, and store them in the vector database.
[0038] S1.2. During retrieval, a hybrid retrieval method is adopted, combining vector retrieval, keyword retrieval, and an approximate BM25 algorithm to obtain knowledge.
[0039] S1.3. During the generation stage, the knowledge is filtered, summarized, and transformed. Samples are generated based on the knobs at different levels processed in the tuning stage, and the relevant knobs are integrated.
[0040] The search space optimizer works by using a large language model to classify the memory pool metrics, compressing the metrics using the factor analysis algorithm for dimensionality reduction, obtaining the metrics with large variations in the best samples of the genetic algorithm, and combining the knowledge of the expert system to obtain a complete knob list. The construction of the mapping module specifically includes the following steps: S4.1. Use a large language model (LLM) to classify the metrics in the memory pool.
[0041] S4.2. Adopt the factor analysis (FA) algorithm to compress the metrics, reduce the data dimensionality, and retain the main features.
[0042] S4.4. Obtain the metrics with the largest variations in the best samples in the genetic algorithm stage. Through the expert system, obtain the workload-level and knob-level knowledge, and merge them to obtain a complete knob list.
[0043] In another embodiment, the method for tuning database parameters guided by a large language model specifically adopts the following steps: A1. The workload generator in the proxy module captures the workload from the user database for tuning iterations. During training, the workload mostly comes from open-source benchmark tests.
[0044] A2. The controller replicates the database instance in the cloud to ensure the performance of the user database and prevent adverse effects caused by knob configuration problems.
[0045] A3. The metric collector collects the metrics after the workload of the cloned database instance is executed, which are divided into internal and external metrics. After being calculated and processed in a specific manner, they are used for tuning.
[0046] A4. Knowledge acquisition of the hybrid tuning system expert system (RRAG algorithm).
[0047] A5. Based on the genetic algorithm, high-quality samples are generated according to the rules and the expert system, including a series of operations such as initializing the population to overcome the cold start problem.
[0048] A6. Store the genetic algorithm samples, provide metrics for the search space optimizer, and assist in the warm start of the deep reinforcement learning model. The samples contain specific information and have a different format from the training samples.
[0049] A7. Use a large language model to classify the metrics, compress them using the factor analysis algorithm, and obtain the optimized knob knowledge by comparing the samples through the expert system.
[0050] A8. The recommender uses an optimized λ-DDPG algorithm, which includes various elements and neural network structures, and adopts a delayed update strategy to stabilize the reinforcement learning process and recommend configurations.
[0051] First, the parameter tuning method of the present invention is as Figure 2 shown, aiming to give the best parameter configuration of the database. This method consists of two parts: a controller and a hybrid tuning system. The controller, as the middle layer, is responsible for interacting with the user database and the hybrid tuning system, including an agent module (including a workload generator and a metric collector) and a cloned database module. The workload generator captures the workload from the user database and replicates the database instance in the cloud for tuning. The metric collector collects the metrics after the workload is executed, which are divided into internal (including status values and cumulative values) and external (throughput and latency) metrics. After specific calculations and processing, they provide a basis for tuning. The hybrid tuning system includes an expert system, a memory pool, and three pipeline modules (sample workshop, search space optimizer, recommender), which cooperate together to complete knob tuning.
[0052] Part A1 uses the workload generator to capture the workload from the user database for tuning iterations. Since tuning needs to truly reflect its workload situation to find the appropriate knob configuration; during training, the workload mostly comes from open-source benchmark tests because they provide standardized and repeatable patterns, which are convenient for unified training and evaluation, ensure the comparability of experiments, and cover various common database operation types, helping to improve the adaptability to different workloads.
[0053] Part A2 replicates the database instance in the cloud, aiming to carry out tuning operations without affecting the normal operation of the user database. Since the adjustment of knob parameter configurations during tuning may cause performance fluctuations and failures of the database, replicating an independent instance can isolate the tuning process from the user database, ensure its performance stability, avoid tuning affecting user services, and also reduce the risk of security problems caused by misconfigurations.
[0054] Part A3 interacts with the cloned database instance through a specific interface to comprehensively capture various data after the workload is executed, including information on query execution, resource usage, storage, and transaction processing. According to the nature of the metrics, they are divided into internal (such as buffer size, lock timeout, etc.) and external (throughput and latency) metrics. Among the internal metrics, the status values are collected at fixed intervals and the average value over a period of time is calculated, and the cumulative values are calculated as differences; the external metrics are sampled every 5 seconds and averaged. These calculated and processed metrics are used as the basis for reinforcement learning rewards for tuning decisions, guiding the database to adjust the knob configuration to achieve the best performance.
[0055] Part A4 is as Figure 3As shown in the figure, in the indexing stage, the database tuning document is optimized by chapter and content block to improve the accuracy of knob knowledge extraction. A summary tree based on the table of contents structure is constructed and stored in the vector database. By combining the document structure with the knowledge content and leveraging the characteristics of the vector database, it facilitates retrieval. In the retrieval stage, a hybrid retrieval method that combines vector retrieval and keyword retrieval is adopted. The former uses the vector space model for preliminary screening, and the latter for precise positioning. The HNSW algorithm is used for vector retrieval, and the approximate BM25 algorithm is used for full-text retrieval to rank knowledge chunks, improving the comprehensiveness and accuracy of retrieval. In the generation stage, knowledge filtering is first performed. Noise is removed based on the authority of the knowledge source, and reliable information is retained. Then, the large language model summarizes the knowledge according to the designed template to make it organized and usable. Finally, the knowledge is converted into JSON format, which is convenient for computer processing, storage, and interaction with other components, clearly representing the knob information and attributes in different stages for easy operation and management.
[0056] In part A5, the cold start problem of generating samples based on the genetic algorithm (GA) is addressed. Since there is a lack of prior information in cold start, it is difficult to determine the knob configuration. GA simulates evolution to explore solutions in a large space. The initial population contains multiple types of values to expand the possibilities of initial search. Default values are provided for initial reference, expert values guide the direction, and uniform values increase randomness. A fitness function that combines throughput and latency is defined. Since these two are key metrics, comprehensive evaluation guides GA to improve overall performance. The selection strategy follows the principle of adaptive survival, allowing high-probability participation of excellent samples in evolution to promote convergence. The crossover strategy hybridizes individuals to retain the excellent and introduce new combinations to increase diversity. The mutation strategy modifies elements according to probability to avoid local optima and expand the range to generate high-quality samples.
[0057] In part A6, the genetic algorithm samples are stored. Since they contain potential optimal configurations and performance information for tuning, they provide a data basis for search space optimization and model training. Metrics are provided for the search space optimizer, which analyzes the advantages and disadvantages of configurations based on the information in the samples to improve with optimal knobs. It helps the deep learning model for warm start. The samples are used as initial training data to give the model experience and reduce training time. The samples contain multiple types of information and have a different format from the samples for deep learning training. Because different stages require different formats to meet specific needs, the samples in the memory pool are re-stored with comprehensive information, and the samples for deep learning training are suitable for model training and policy learning.
[0058] In part A7, the FA algorithm is used to compress the metrics. It can extract the main factors from multiple related variables, retain the main information, reduce the data volume and computational complexity, and improve the efficiency of the search space optimizer. The knowledge of optimized knobs is obtained relying on the expert system. Because it can comprehensively consider the characteristics of the database and the relationship between knobs, accurately locate the key knobs by comparing the changes in sample metrics, and obtain targeted and effective strategies and a complete and reasonable knob list in combination with expert suggestions. Experimental control variables balance tuning and computational cost.
[0059] The A8 part uses the λ-DDPG algorithm. Since DDPG is sensitive to initial conditions and has unstable training problems, the λ-DDPG introduces a delayed update strategy, which can stabilize reinforcement learning and reduce performance fluctuations. A reinforcement learning framework is constructed with multiple elements, enabling the recommender to select actions based on the database state and optimize the strategy to improve performance. It consists of two neural networks. The DDPG-Actor learns and generates action policies, and the DDPG-Critic evaluates rewards, collaborating to optimize decisions. The delayed update limits the network update frequency to ensure policy stability, avoiding instability and suboptimal solutions caused by frequent updates, and effectively exploring the search space to find optimal parameter configurations to improve database performance.
[0060] In one embodiment, constructing an index for the obtained tuning information includes the following steps: For database tuning documents, instead of directly dividing them into blocks of a fixed length, they are first divided by chapter and then by content, focusing on the knowledge of individual knobs. For example, for the MySQL 8.0 reference manual, its content will be subdivided by chapter to ensure that each part can clearly correspond to specific knob knowledge, facilitating subsequent processing.
[0061] Construct a summary tree according to the manual's table of contents structure. Using the document title as the root node, subsequent nodes represent the subdivided parts of the document. Each child node contains the content of the parent chapter and the chapter summary (as a text index) generated by a large language model (LLM). In the experiment, the Unstructed tool is used to extract elements such as text, tables, and images from the document, input them into an LLM with summarization capabilities, and store the processed results in a vector database to prevent loss of original data.
[0062] In one embodiment, retrieving available tuning information specifically includes: introducing a hybrid retrieval method that combines vector retrieval (such as using the HNSW algorithm) and keyword retrieval (implementing an approximate BM25 algorithm), and re-ranking the retrieved documents through a re-ranking model. In the BM25 algorithm, the knowledge chunks are ranked by calculating "Score(D,Q)", and the parameters involved include the knowledge chunk D, the metric set Q, the frequency of the metric in the knowledge chunk, the average knowledge chunk length, free hyperparameters, and the inverse document frequency, etc. For example, for the metric set Q reflecting the database state, scores are calculated based on factors such as its frequency in different knowledge chunks to determine the most relevant knowledge chunk.
[0063] In one embodiment, processing the tuning source information through a large language model specifically includes: Filtering the obtained knowledge. When the original knowledge conflicts with the LLM's own knowledge, they are sorted in the order of the database vendor manual, forum answers, and the authority of the LLM's own knowledge to filter out noise and preferentially select the most reliable information. For example, when dealing with conflicts regarding the recommended value of a certain knob, the suggestions in the manual will be preferentially referred to.
[0064] Summarize the filtered knowledge. The LLM summarizes all relevant information according to the designed prompt template. The prompt template specifies the role (such as expert manager), stage (such as search space optimizer stage), rules (such as DBA rules), metrics (such as all metrics inside the database), and tasks (such as classifying metrics or extracting target knob values, etc.).
[0065] For computer processing convenience, the knowledge is converted into JSON format. When processing different types of knobs at different stages, the text analysis ability of the LLM is utilized to extract relevant information according to specific situations. For example, in the GA stage of generating samples, system-level (such as the advice of the IO expert on the "effective io concurrency" knob) and query-level (such as the query plan expert adjusting bottleneck-aware knobs like "random page cost" according to "seqscan" in the execution plan) knobs are processed; in the search space optimizer stage, workload-level (determining relevant knobs according to sample metric classification in the memory pool) and knob-level (extracting dependent knobs according to the manual) knobs are processed.
[0066] In one embodiment, generating high-quality optional parameter samples specifically includes: Establish an initial population containing n samples according to the genetic algorithm (GA) theory. Adopt the default knob values provided by the database provider, Adopt the system-level and query-level knob recommended values recommended by the expert system, to Be evenly distributed within the default value range recommended by the expert system.
[0067] Evaluate the quality of an individual (i.e., database configuration) by combining throughput and latency into a fitness function. The fitness function is ; where 、 、 represent the throughput under the current, default, and recommended configurations respectively, 、 、 represent the latency under the current, default, and recommended configurations respectively, and are hyperparameters that control the weights of throughput and latency.
[0068] GA selects individuals according to the adaptive survival principle. The higher the individual fitness, the greater the probability of being selected. The selection probability formula is .
[0069] Select and through the selection strategy, and hybridize some of their values to generate new individuals . For example, let a subset of (including the first elements) and the remaining part of to form a new individual.
[0070] GA changes the value of each element with a certain probability (within the range recommended by the expert system) to generate a new individual , so as to widely explore the search space.
[0071] In one embodiment, optimizing the search space of database parameters specifically includes: Using the LLM as a classifier, classify 63 metrics in the memory pool into six different groups through the RRAG technology. The specific operation is to identify the metrics with the most significant change rate compared with the default value among different expert-related metrics, and incorporate them into the prompts of the corresponding experts to obtain the knowledge of optimization knobs.
[0072] Adopt the factor analysis (FA) algorithm for metric compression, find the main direction of the data through eigenvalue decomposition, compress the high-dimensional data into a low-dimensional space, and retain the main features at the same time.
[0073] Obtain the metrics with the largest change compared with the default sample in the best-performance samples in the genetic algorithm stage, obtain the workload-level and knob-level knob knowledge according to the recommendations of the expert system, and merge them with the genetic algorithm knobs to obtain a complete knob list (control its quantity as a fixed value in the experiment).
[0074] In one embodiment, in the hyperparameter recommendation stage, select the optimized DDPG algorithm (λ-DDPG) to recommend the best configuration. In the DDPG algorithm, the following key elements are involved: Agent: It is a DDPG model that determines the strategy and recommends actions according to the environmental reward and state, and learns the policy function through a neural network , maps the state s to the action a, with the weight of .
[0075] Environment: It is the database to be tuned, which is the database cloned by the controller here.
[0076] State: It is the current state representation of the database collected by the metric collector in the controller, and is compressed by the FA algorithm before being input into the agent.
[0077] Action: It is the database configuration containing the selected top k knob values.
[0078] Reward: Describes the gap between the performance generated by the current action and the default performance, and is calculated in the same way as the fitness function in step 5.2.
[0079] Policy: A parameter of the agent used to map the state s to the action a. Through reward adjustment, the reward is maximized, and in implementation, it is the parameter of the neural network.
[0080] The DDPG-Actor learns the policy function, and the DDPG-Critic learns the evaluation function based on the recommended action , and evaluates the quality of the policy. At the same time, delayed update and soft update methods are adopted to make the reinforcement learning more stable, ensure that the evaluation network and the policy network use the same policy, and the evaluation results are stable within a certain number of training cycles.
[0081] Under different database management systems (such as PostgreSQL and MySQL) and different benchmark tests (such as TPC-C and TPC-H), this method can successfully recommend the optimal configuration, and has obvious advantages compared with other existing methods (such as DDPG, OtterTune, SMAC, DB-BERT, etc.). On PostgreSQL, the average convergence time is 11.2 times faster than other methods, and the performance improvement is up to 26%; on MySQL, for the TPC-H workload, this method significantly reduces the latency (such as reducing 50.8%) after 60 rounds of optimization by the genetic algorithm assisted by the expert system, and further reduces the latency in subsequent optimizations, and achieves the highest throughput for TPC-C (such as 981tx / s, a significant increase compared with the default 237tx / s).
[0082] For the foregoing embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, some steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to the preferred embodiments, and the actions involved are not necessarily essential to this application.
[0083] In the above embodiments, the basic principles, main features and advantages of the present invention are described. Those skilled in the art of this industry should understand that the present invention is not limited by the above embodiments. What is described in the above embodiments and the specification only illustrates the principles of the present invention. Without departing from the spirit and scope of the present invention, any changes and modifications made by those skilled in the art without departing from the spirit and scope of the present invention shall fall within the protection scope of the appended claims of the present invention.
Claims
1. A database parameter tuning method based on expert guidance of multiple language models, characterized in that: The following steps are involved: Step S1: Build an expert system, use the RRAG algorithm to process documents to build a hierarchical index to save summaries, perform hybrid retrieval to obtain knowledge, and generate sample integration based on the processing knobs in the tuning stage; Step S2: The sample workshop operation is based on the genetic algorithm GA, which initializes the population with specific values, evaluates the fitness function combining throughput and delay, selects individuals according to the adaptive survival principle, crosses them, and changes elements according to probability to generate high-quality samples; Step S3: Store samples generated by the genetic algorithm GA. The samples contain indicators, configurations, and performance information, provide indicators for the search space optimizer, and help the hot start of the deep reinforcement learning model. Step S4: The search space optimizer classifies and compresses the memory pool indicators, obtains the genetic algorithm sample change indicators and combines them with expert knowledge to form a complete knob list; Step S5: Using the optimized DDPG algorithm λ-DDPG, considering multiple factors, and recommending the best configuration by improving the stability of reinforcement learning through delayed update and soft update strategies.
2. The method for tuning database parameters based on expert guidance of multiple language models as claimed in claim 1, characterized in that: The step S1 specifically includes the following sub-steps: Step S11: using the remix retrieval enhancement generation RRAG algorithm, firstly index the database tuning documents, divide them into blocks according to chapters and contents and build a hierarchical index, extract elements to generate summaries and store them in the vector database; Step S12: using a hybrid search method combining vector search and keyword search and an approximate BM25 algorithm to acquire knowledge; Step S13: The generation phase filters, summarizes and transforms the knowledge, generates samples based on the knobs at different levels processed in the tuning phase and integrates related knobs.
3. The method for optimizing database parameters based on expert guidance of multiple language models as claimed in claim 2, characterized in that: The step S11 of constructing a hierarchical index specifically includes: Divide the database tuning documentation by chapter and then by content, focusing on the knowledge of a single knob; A summary tree is constructed based on the manual directory structure, with the document title as the root node. Subsequent nodes represent document subdivisions. Each child node contains the content of the parent chapter and the chapter summary generated by the large language model LLM.
4. The method for optimizing database parameters based on expert guidance of multiple language models as claimed in claim 3, characterized in that: The step S1 generates sample integration based on the processing knob in the tuning stage and processes the tuning source information through the large language model, specifically including: Filter the acquired knowledge; To summarize the filtered knowledge, the large language model LLM summarizes all relevant information according to the designed prompt template; Convert knowledge into JSON format and use the text analysis capabilities of LLM to extract relevant information according to specific circumstances when processing different types of knobs at different stages.
5. The method for optimizing database parameters based on expert guidance of multiple language models as claimed in claim 1, characterized in that: The step S2 of generating high-quality samples comprises the following steps: Step S21: Establish an initial population based on the genetic algorithm GA theory, including n samples; Use the default knob values provided by the database provider. Use the system-level and query-level knob values recommended by the expert system. arrive Uniform distribution within the range of default values suggested by the expert system; Step S22: The quality of individual database configuration is evaluated by combining throughput and delay into a fitness function, where the fitness function is: ; in , , Respectively represent the throughput under current, default, and recommended configurations, , , Respectively represent the delay under the current, default, and recommended configurations, and Hyperparameters to control throughput and latency weights; Step S23: Genetic algorithm GA selects individuals according to the adaptive survival principle. The higher the individual fitness, the greater the probability of being selected. The selection probability formula is: ; Step S24: Select by selecting strategy and , and cross-breed its partial values to generate new individuals ; Step S25: Genetic algorithm GA with a certain probability Change the value of each element within the range recommended by the expert system to generate new individuals , explore the search space.
6. The method for optimizing database parameters based on expert guidance of multiple language models as claimed in claim 1, characterized in that: The step S4 specifically comprises the following steps: Step S41: using the large language model LLM as a classifier, classifying the indicators in the memory pool into multiple different groups through the RRAG technology, identifying the indicators with the most significant change rate compared with the default value among the relevant indicators of different experts, and incorporating them into the prompts of the corresponding experts to obtain the knowledge of the optimization knob; Step S42: using the factor analysis FA algorithm to compress the index, finding the main direction of the data through eigenvalue decomposition, compressing the high-dimensional data into a low-dimensional space, while retaining the main features; Step S43: Obtain the indicator with the largest change compared with the default sample in the best performance sample in the genetic algorithm stage, obtain the knob knowledge of the workload level and knob level according to the expert system recommendation, and merge it with the genetic algorithm knob to obtain a complete knob list.
7. The method for optimizing database parameters based on expert guidance of multiple language models as claimed in claim 1, characterized in that: The DDPG algorithm λ-DDPG optimized in step S5 is a multi-factor reinforcement learning framework that allows the recommender to select actions based on the database state and optimize the strategy to improve performance; the optimized DDPG algorithm consists of two neural networks, specifically: DDPG-Actor learns and generates action strategies, and DDPG-Critic learns evaluation functions based on recommended actions. , evaluate the quality of the strategy.
8. The method for optimizing database parameters based on expert guidance of multiple language models as claimed in claim 7, characterized in that: The optimized DDPG algorithm elements include: Agent: A DDPG model that determines strategies and recommends actions based on environmental rewards and states, and learns policy functions through neural networks , maps state s to action a, with weight ; Environment: The database to be tuned is cloned by the controller; State: represents the current state of the database collected by the indicator collector in the controller and compressed by the FA algorithm before being input into the agent; Action: A database configuration containing the selected top k knob values; Reward: Describes the performance difference between the current action and the default performance.
Citation Information
Cited By
Deep learning task-oriented operating system kernel parameter tuning system and method
CN121092223A