SAT solver heuristic function optimization method based on large language model

Through the heuristic function optimization method based on large language model, the problem that SAT solver is difficult to adapt and optimize in different scenarios is solved, and the performance improvement and generalization ability of SAT solver are enhanced to adapt to the needs of various SAT instances.

CN119271940APending Publication Date: 2025-01-07SHANGHAI FORMAL TECH INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411316125.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

Existing SAT solvers are difficult to adapt to various SAT instances universally, and optimization methods are of great challenges, and it is difficult to achieve efficient solution functions in different demand scenarios.

Method used

Adopt the heuristic function optimization method based on the large language model. By analyzing the source code of the SAT solver, extracting and generating optimized heuristic functions, combining the training set and the verification set for optimization, using the large language model to generate better heuristic functions, and gradually Improve the performance and generalization capabilities of SAT solvers.

Benefits of technology

The performance optimization of the SAT solver is realized, adapting to SAT problems of different scales and complexities, improving the efficiency and generalization capabilities of the solver, ensuring that better solutions are obtained at each stage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271940A_ABST
    Figure CN119271940A_ABST
Patent Text Reader

Abstract

The invention discloses an SAT solver heuristic function optimization method based on a large language model, and belongs to the technical field of function optimization methods.The method comprises the steps that the large language model analyzes SAT solver source codes, and heuristic functions possibly optimized in the SAT solver source codes are extracted; selecting a heuristic function optimized in the step according to a formulated heuristic function selection strategy; obtaining a to-be-optimized original heuristic function, preparing a training set and a verification set, and determining experimental parameters, such as an overtime threshold of a test SAT solver and a current sample number limit; initializing a code database, running an original SAT solver on a verification set, and initializing a score table and scores; and generating prompt words, providing the prompt words to the large language model, and obtaining feedback of the large language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a function optimization method, in particular to a SAT solver heuristic function optimization method based on a large language model, and belongs to the technical field of function optimization methods. Background Art

[0002] The international SAT research community organizes the SAT Competition every year. It is an international competition that aims to promote the development of SAT solvers and related technologies and methods. This competition provides a platform for researchers and developers to demonstrate the performance of their solvers and improve the efficiency and effectiveness of their respective technologies through mutual comparison. The results of the competition are constantly changing every year, and it is never certain who will win the championship.

[0003] In industrial practice, for example, in the field of software verification, SAT solvers are used to verify complex logical conditions in the software to ensure that the software behavior meets the specifications; in hardware design and verification, SAT solving technology can be used to check the consistency and functionality of circuit design; SAT solvers are also used in the field of cryptography to analyze and attack encryption algorithms.

[0004] The development of SAT solvers also has different focuses for different demand scenarios. However, in the face of these endless SAT solvers, existing methods cannot adapt to various SAT instances universally, and there are considerable difficulties and challenges in the optimization of methods. The field of code generation and improvement through large language models (LLMs) is developing rapidly. This progress is due to the breakthroughs in natural language processing and machine learning technologies in recent years, especially the great achievements of deep learning models in understanding and generating human language. LLMs, such as GPT-4, can generate high-quality code based on large training data sets that cover various programming languages, frameworks, and code libraries. Therefore, it is very necessary to develop a method that can universally optimize various SAT solvers by taking advantage of the advantages of large language models in the field of code generation and improvement. This method gives full play to the advantages of large language models, and combined with the guidance of appropriate prompt words and evaluation methods, it can be efficiently applied to different SAT solvers and achieve the effect of optimizing their solving functions. Summary of the invention

[0005] The main purpose of the present invention is to provide a SAT solver heuristic function optimization method based on a large language model.

[0006] The purpose of the present invention can be achieved by adopting the following technical solutions:

[0007] A heuristic function optimization method for a SAT solver based on a large language model comprises the following steps:

[0008] Step 1: Analyze the SAT solver source code with a large language model and extract the heuristic function for optimization;

[0009] Step 2: According to the established heuristic function selection strategy, select the heuristic function to be optimized in this step;

[0010] Step 3: Obtain the original heuristic function to be optimized, the training set and the validation set, and determine the experimental parameters;

[0011] Step 4: Initialize the code database, run the original SAT solver on the validation set, and initialize the score table and scores;

[0012] Step 5: Generate prompt words, provide them to the large language model and obtain feedback from the large language model;

[0013] Step 6: Extract the new heuristic function from the feedback, construct a new SAT solver, and if the compilation is successful, update the code database and proceed to the next step, otherwise return to step 5;

[0014] Step 7: Complete the training set test, obtain the score of the new SAT solver on the training set, and compare it with the score of the corresponding entry in the score table. If the score is higher, proceed to the next step, otherwise return to step 5;

[0015] Step 8: Complete the validation set test, obtain the score of the new SAT solver on the validation set, and compare it with the score table. If the score is higher, proceed to the next step, otherwise return to step 5;

[0016] Step 9: Update the score table and scores, and repeat steps 5 to 9 until the sample number limit is reached and then proceed to the next step;

[0017] Step 10: Obtain a SAT solver with better performance, complete the test set test, evaluate the performance of the new SAT solver, and determine the timeout threshold for the next stage.

[0018] Preferably, in step 1, the large language model analyzes the SAT solver source code to extract the heuristic function that may be optimized, and the heuristic function may include variable collision processing and restart operation.

[0019] Preferably, in step 2, the heuristic function to be optimized in this step is selected according to a formulated heuristic function selection strategy, and the heuristic function selection strategy selects a function according to the current optimization stage, or optimizes the selected functions alternately.

[0020] Preferably, step three is to obtain the original heuristic function to be optimized, prepare a training set and a validation set, and determine experimental parameters, wherein the training set is a proper subset of the validation set;

[0021] The experimental parameters include a timeout threshold for testing the SAT solver and a limit on the number of samples for this test.

[0022] Preferably, step 4 initializes the code database, runs the original SAT solver on the validation set, initializes the score table and the score, and the code database is used to record the generated legal functions;

[0023] The score table shows the completion status of all instances in the validation set within the timeout threshold, where completion is counted as TRUE and failure is counted as FALSE;

[0024] The score is the number of completions of all instances in the validation set within the timeout threshold.

[0025] Preferably, in step 5, prompt words are generated and provided to the large language model, and feedback from the large language model is obtained, wherein the prompt words include a description of the original heuristic function given by the user and a code example from the code database;

[0026] The feedback includes an updated heuristic function given by the large language model and a description of the new function.

[0027] Preferably, step six extracts a new heuristic function from the feedback, constructs a new SAT solver, and if the compilation is successful, updates the code database and proceeds to the next step, otherwise returns to step five, wherein updating the code database includes adding the legal function to the code database and adding it when the prompt word is generated next time.

[0028] Preferably, step seven completes the training set test, obtains the score of the new SAT solver on the training set, and compares it with the score of the corresponding entry in the score table. If the score is higher, proceed to the next step, otherwise return to step five. The score of the corresponding entry in the score table refers to the total number of TRUE results in the current training set in the score table.

[0029] Preferably, step eight completes the validation set test, obtains the score of the new SAT solver on the validation set, and compares it with the score table. If the score is higher, proceed to the next step, otherwise return to step five.

[0030] Preferably, in step nine, the score table and the score are updated, and steps five to nine are repeated until the sample number limit is reached and the next step is entered. The sample number limit refers to the maximum number of samples set in this experiment. When the generated function reaches this threshold, the optimization ends.

[0031] Step 10 obtains a SAT solver with better performance, completes the test set test, evaluates the performance of the new SAT solver, and determines the timeout threshold for the next stage. The timeout threshold for the next stage refers to the idea based on curriculum learning. After the optimization of this stage is completed, the timeout threshold of the test is expanded to obtain a SAT solver with better performance on a more complex problem scale.

[0032] Beneficial technical effects of the present invention:

[0033] The present invention provides a SAT solver heuristic function optimization method based on a large language model. The present invention fully utilizes the advantages of the large language model in code generation and uses an appropriate method to generate prompt words to stimulate the potential of the large language model to optimize the heuristic function.

[0034] The present invention divides the experimental stages according to the timeout threshold based on the course learning method, and gradually optimizes the SAT solver to ensure that a better solution is obtained in each stage, so that the solver can adapt to SAT problems of different scales and complexities.

[0035] The present invention guides a large language model to generate a better heuristic function by combining a training set and a validation set, thereby improving the optimization efficiency of a SAT solver and improving its generalization ability. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A flowchart of a preferred embodiment of a SAT solver heuristic function optimization method based on a large language model according to the present invention;

[0037] Figure 2 A schematic diagram of a validation set and a test set according to a preferred embodiment of a SAT solver heuristic function optimization method based on a large language model of the present invention. DETAILED DESCRIPTION

[0038] In order to make the technical solution of the present invention more clear and specific to those skilled in the art, the present invention is further described in detail below in conjunction with embodiments and drawings, but the implementation manner of the present invention is not limited thereto.

[0039] Embodiment 1, a SAT solver heuristic function optimization method based on a large language model, comprising the following steps:

[0040] The following is combined with Figure 1 A heuristic function optimization method for a SAT solver based on a large language model of the present invention is introduced in detail. Figure 1 As shown, the method mainly includes the following steps:

[0041] Step S1: The large language model analyzes the SAT solver source code and extracts the heuristic functions that may be optimized;

[0042] Step S2: According to the established heuristic function selection strategy, the heuristic function to be optimized in this step is selected;

[0043] Step S3: Obtain the original heuristic function to be optimized, prepare the training set and the validation set, and determine the experimental parameters;

[0044] Step S4: Initialize the code database, run the original SAT solver on the validation set, and initialize the score table and scores;

[0045] Step S5: Generate prompt words, provide them to the large language model, and obtain feedback from the large language model;

[0046] Step S6: extract the new heuristic function in the feedback, construct a new SAT solver, and if the compilation is successful, update the code database and proceed to the next step, otherwise return to step S5;

[0047] Step S7: Complete the training set test, obtain the score of the new SAT solver on the training set, and compare it with the score of the corresponding entry in the score table. If the score is higher, proceed to the next step, otherwise return to step S5;

[0048] Step S8: Complete the validation set test, obtain the score of the new SAT solver on the validation set, and compare it with the score table. If the score is higher, proceed to the next step, otherwise return to step S5;

[0049] Step S9: Update the score table and scores, and repeat steps S5-S9 until the sample number limit is reached and then proceed to the next step;

[0050] Step S10: Obtain a SAT solver with better performance, complete the test set test, evaluate the performance of the new SAT solver, and determine the timeout threshold for the next stage.

[0051] In one embodiment, the step S1: large language model analyzes SAT solver source code to extract heuristic functions that may be optimized, and the heuristic functions may include operations such as variable collision processing and restart.

[0052] In one embodiment, the step S2: according to a formulated heuristic function selection strategy, the heuristic function to be optimized in this step is selected. The heuristic function selection strategy selects a function according to the current optimization stage, or optimizes the selected functions alternately.

[0053] In one embodiment, the step S3: obtaining the original heuristic function to be optimized, preparing a training set and a validation set, and determining experimental parameters, such as Figure 2 As shown, the training set is a true subset of the validation set; the experimental parameters include a timeout threshold for testing the SAT solver and a limit on the number of samples for this test.

[0054] In one embodiment, step S4: initializes the code database, runs the original SAT solver on the verification set, initializes the score table and score, the code database is used to record the generated legal functions; the score table is the completion status of all instances in the verification set within the timeout threshold, completion is counted as TRUE, and incompleteness is counted as FALSE; the score is the number of completions of all instances in the verification set within the timeout threshold.

[0055] In one embodiment, step S5: generates prompt words, provides them to the large language model, and obtains feedback from the large language model, wherein the prompt words include a description of the original heuristic function given by the user and a code example from a code database; the feedback includes an updated heuristic function given by the large language model and a description of the new function.

[0056] In one embodiment, step S6: extracts the new heuristic function in the feedback, constructs a new SAT solver, updates the code database and proceeds to the next step if the compilation is successful, otherwise returns to step S5, and the updating of the code database includes adding the legal function to the code database and adding it when the prompt word is generated next time.

[0057] In one embodiment, step S7: complete the training set test, obtain the score of the new SAT solver on the training set, and compare it with the score of the corresponding entry in the score table. If the score is higher, proceed to the next step, otherwise return to step S5. The score of the corresponding entry in the score table refers to the total number of TRUE results of the current training set in the score table.

[0058] In one embodiment, step S8: complete the validation set test, obtain the score of the new SAT solver on the validation set, compare it with the score table, if the score is higher, proceed to the next step, otherwise return to step S5. The validation set test is to ensure that the performance of the generated new function is also well improved on a larger data set, thereby ensuring the good generalization of the method.

[0059] In one embodiment, step S9: updates the score table and scores, repeats steps S5-S9, and proceeds to the next step after reaching the sample number limit. The sample number limit refers to the maximum number of samples set in this experiment. When the generated function reaches this threshold, the optimization ends.

[0060] In one embodiment, the step S10: obtains a SAT solver with better performance, completes the test set test, evaluates the performance of the new SAT solver, and determines the timeout threshold of the next stage. The timeout threshold of the next stage refers to the idea of ​​curriculum learning. After the optimization of this stage is completed, the timeout threshold of the test is expanded to obtain a SAT solver with better performance on a more complex problem scale.

[0061] The above description is only a further embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solutions and concepts of the present invention within the scope disclosed by the present invention, which belong to the protection scope of the present invention.

Claims

1. A heuristic function optimization method for a SAT solver based on a large language model, characterized in that: The steps include: Step 1: Analyze the SAT solver source code with a large language model and extract the heuristic function for optimization; Step 2: According to the established heuristic function selection strategy, select the heuristic function to be optimized in this step; Step 3: Obtain the original heuristic function to be optimized, the training set and the validation set, and determine the experimental parameters; Step 4: Initialize the code database, run the original SAT solver on the validation set, and initialize the score table and scores; Step 5: Generate prompt words, provide them to the large language model and obtain feedback from the large language model; Step 6: Extract the new heuristic function in the feedback, construct a new SAT solver, and if the compilation is successful, update the code database and proceed to the next step, otherwise return to step 5; Step 7: Complete the training set test, obtain the score of the new SAT solver on the training set, and compare it with the score of the corresponding entry in the score table. If the score is higher, proceed to the next step, otherwise return to step 5; Step 8: Complete the validation set test, obtain the score of the new SAT solver on the validation set, and compare it with the score table. If the score is higher, proceed to the next step, otherwise return to step 5; Step 9: Update the score table and scores, and repeat steps 5 to 9 until the sample number limit is reached and then proceed to the next step; Step 10: Obtain a SAT solver with better performance, complete the test set test, evaluate the performance of the new SAT solver, and determine the timeout threshold for the next stage.

2. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 1, characterized in that: In step 1, the large language model analyzes the SAT solver source code and extracts the heuristic function that may be optimized. The heuristic function may include variable collision processing and restart operation.

3. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 2, characterized in that: Step 2: According to the established heuristic function selection strategy, the heuristic function to be optimized in this step is selected. The heuristic function selection strategy will select a function according to the current optimization stage, or optimize the selected function alternately.

4. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 3, characterized in that: Step 3: obtaining the original heuristic function to be optimized, preparing a training set and a validation set, and determining experimental parameters, wherein the training set is a true subset of the validation set; The experimental parameters include a timeout threshold for testing the SAT solver and a limit on the number of samples for this test.

5. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 4, characterized in that: Step 4: Initialize the code database, run the original SAT solver on the validation set, initialize the score table and the score, and the code database is used to record the generated legal functions; The score table shows the completion status of all instances in the validation set within the timeout threshold, where completion is counted as TRUE and failure is counted as FALSE; The score is the number of completions of all instances in the validation set within the timeout threshold.

6. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 5, characterized in that: Step 5: Generate prompt words, provide them to the large language model, and obtain feedback from the large language model, wherein the prompt words include a description of the original heuristic function given by the user and a code example from the code database; The feedback includes an updated heuristic function given by the large language model and a description of the new function.

7. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 6, characterized in that: Step 6 extracts the new heuristic function in the feedback, constructs a new SAT solver, and if the compilation is successful, updates the code database and proceeds to the next step, otherwise returns to step 5. The updating of the code database includes adding the legal function to the code database and adding it when the prompt word is generated next time.

8. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 7, characterized in that: Step 7 completes the training set test, obtains the score of the new SAT solver on the training set, and compares it with the score of the corresponding entry in the score table. If the score is higher, proceed to the next step, otherwise return to step 5. The score of the corresponding entry in the score table refers to the total number of TRUE results in the current training set in the score table.

9. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 8, characterized in that: Step 8: Complete the validation set test, obtain the score of the new SAT solver on the validation set, and compare it with the score table. If the score is higher, proceed to the next step, otherwise return to step 5.

10. The method for heuristic function optimization based on a large language model for a SAT solver according to claim 9, characterized in that: Step 9: Update the score table and scores, and repeat steps 5 to 9 until the sample number limit is reached and then proceed to the next step. The sample number limit refers to the maximum number of samples set in this experiment. When the generated function reaches this threshold, the optimization ends. Step 10 obtains a SAT solver with better performance, completes the test set test, evaluates the performance of the new SAT solver, and determines the timeout threshold for the next stage. The timeout threshold for the next stage refers to the idea based on curriculum learning. After the optimization of this stage is completed, the timeout threshold of the test is expanded to obtain a SAT solver with better performance on a more complex problem scale.

Citation Information

Cited By

  • Virtual machine scheduling heuristic function optimization method based on large language model

    CN120045283A