A meta-evidence perception prompt optimization method for a large language model
By optimizing the prompt design of large language models through clustering and Bayesian reasoning, the problem of redundant information input is solved, the performance and computational efficiency of the model are improved, and the reasoning ability of the model is enhanced.
Patent Information
- Application Number
- CN202510101991.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-01-22
AI Technical Summary
Existing large language model hint optimization methods have the problems of redundant information input leading to misleading and increased computational costs. Soft hint optimization methods introduce noise and information loss, while hard hint optimization methods cannot effectively utilize meta-evidence.
Clustering and Bayesian reasoning are used to conduct a detailed analysis of the causal relationships within the evidence, generating preliminary evidence, clustering, and constructing a directed acyclic graph (DAG) to optimize prompt design, reduce redundant information, and improve model performance.
It effectively reduces redundant information input, improves the performance and computational efficiency of large language models, enhances the model's reasoning ability, and optimizes prompt design.
Smart Images

Figure CN119939294B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of large language model optimization, and specifically provides a method for optimizing meta-evidence-aware prompts of a large language model. Background Art
[0002] Large language models (LLMs) are a crucial component of deep learning, specifically designed for natural language processing (NLP) tasks and achieving remarkable success in a variety of downstream applications. Unleashing the full potential of large language models requires carefully designed task-specific prompts that incorporate detailed instructions and domain insights. Prompt optimization aims to construct effective prompts that fully exploit the capabilities of large language models. The key challenge of prompt optimization lies in analyzing the output of large language models, identifying fine-grained errors as clear prompt flaws, and guiding corrective prompts. However, existing mainstream methods feed all evidence into large language models, resulting in excessive redundant input that can mislead the large language models. Furthermore, this redundant input can increase computational costs. Therefore, this patent explores new methods to reduce redundant input and optimize the design of prompts for large language model tasks. Currently, two main approaches for prompt optimization are under investigation: soft prompt optimization (SPO) and hard prompt optimization (HPO). These two methods are illustrated in Figure 1.
[0003] Soft hint optimization is an important existing approach to address these challenges. These methods optimize hints by training continuous vectors (i.e., hint representations). Soft hints are continuous, learnable vectors that require no manual design and can be automatically optimized for specific datasets using gradient optimization methods to adapt to different tasks. However, continuous vectors are not interpretable and lack flexibility. Because they require access to the internal variables of a large language model, this optimization process can introduce noise and information loss. As shown in the lower left corner of Figure 1, a large language model generates evidence as an initial hint and then edits the hint based on the corresponding evidence. However, the output ignores the ambiguity of the definition of lie in the initial hint and introduces noise (pay attention to the accuracy of the data), which affects the performance of the edited hint. Hard hint optimization utilizes the iterative feedback process of LLMs to refine the hint. Compared to soft hint optimization methods, these methods do not require access to the internal variables of the large language model, thus reducing the risk of noise and information loss. However, hard hint optimization methods still have a problem: they cannot find meta-evidence, which is a key hint defect obtained by eliminating redundant information. As shown in the lower right corner of Figure 1, the initial hint contains other information and external knowledge with similar meaning. First, the large language model generates evidence for the initial prompt, using broadly defined deficiencies such as "additional information" and "external knowledge." Then, a hard hint refinement method edits the prompt into corresponding evidence based on the given context, avoiding the inclusion of external details. These two new prompts are semantically similar, causing the large language model to waste computational resources. Summary of the Invention
[0004] To address the above issues, the present invention proposes a meta-evidence-aware prompt optimization method for a large language model, which uses clustering and Bayesian reasoning to perform a detailed analysis of the causal relationship within the evidence.
[0005] To achieve the above object, the technical solution adopted by the present invention is:
[0006] A method for optimizing meta-evidence-aware prompts for a large language model, characterized by the following specific steps:
[0007] Step 1: Generate preliminary evidence;
[0008] Step 2: Binary evidence identification;
[0009] Step 3: Optimization of evidence perception prompts. As a further improvement of the present invention, the step 1 of generating preliminary evidence is as follows:
[0010] Preliminary evidence introduced As feedback to the model, the shortcomings of the current prompt are pointed out and the mini-batch data is As a reminder Input into the large language model to obtain the loss signal , the initial evidence generation can be formalized as follows:
[0011]
[0012] The preliminary evidence was presented in a sequential format, and to enhance the relevance of the output, the amount of evidence was limited by adding prompts: Give five reasons why the prompts would misunderstand the examples.
[0013] As a further improvement of the present invention, the binary evidence identification step is specifically as follows:
[0014] After generating preliminary evidence, clustering is used to remove similar evidence and Bayesian reasoning is used to capture the causal relationship in the evidence;
[0015] Evidence group clustering;
[0016] Given preliminary evidence , using the embedding model Each piece of evidence Embedded into vector , as shown below:
[0017]
[0018] in Represents the evidence embedding set, then, the K-means algorithm is applied to initialize Empty cluster, represented by , each cluster set Match an initial center , the set of all centers can be defined as For each , calculate its The Euclidean distance of all centers in Add to the nearest matching cluster After adding all points, update as follows Each center :
[0019]
[0020] Repeat the iterative process until each cluster center set no longer changes, in which the second stage, preliminary evidence According to their distance from the cluster center, they are clustered into 3 cluster centers, namely 、 and ;
[0021] identification of causal relationships in evidence;
[0022] In order to obtain the causal relationship between cluster centers, a set of cluster center pairs is constructed, which is recorded as , using the Bayesian method, through the large language model to infer the causal relationship between cluster center pairs, for each cluster center pair , the prompt template is Given the feedback cluster center: , is it possible to infer the feedback cluster centers is also true, answer yes or no, then, Input a large language model and query from infer The probability is:
[0023]
[0024] in, represents the output of the large language model, is an indicator function that is equal to 1 if the condition is true. Finally, Find the probability of all center pairs in ;
[0025] Constructing evidence maps;
[0026] For each cluster center , construct a directed cluster center graph , where the edge weight is , use the maximum spanning tree algorithm MST to identify the subgraph with the largest sum of weights in the cluster center graph, which is in the form of;
[0027]
[0028] in represent All possible spanning trees in It's the edge Finally, the maximum spanning tree Convert to a DAG, preserving the direction of edges and eliminating cycles in the graph, By vertex set and edge sets Composition, which is defined as follows:
[0029]
[0030] in, and ;
[0031] In the second stage, three cluster centers It is eventually transformed into a DAG with the following causal relationships: .
[0032] As a further improvement of the present invention, the step 3 of evidence perception prompting is optimized as follows:
[0033] Complexity metrics based on model parameter norms and outputs;
[0034] The large language model generates refined hints based on structured meta-evidence. First, the large language model generates refined hints based on From the current prompt Generate iteration 1 Candidate hints, denoted as Then, in iteration 2, for each , instructing the large language model to generate additional candidate ,yes Next, we label the candidate prompts for iteration 2 as , repeat the above process until the maximum number of iterations is reached , for the Iterations, candidate prompts It can be expressed as:
[0035]
[0036] in Finally, this patent will produce the last iteration of As the final evidential perception cue;
[0037] Tips Optimization
[0038] Once the initial hint is expanded into multiple candidate hints, the refinement step occurs in In the time step, select the front Candidate hints remain on the beam for the next iteration, simulating this step as a multi-armed bandit problem. In each iteration, Select hints using enhanced upper confidence bound algorithm for:
[0039]
[0040] in, is the exploration parameter, Is the prompt The performance estimate of is the current time step From the prompt The number of queries, then, in the sampled data set Evaluate selected prompts performance and calculate the reward ,Finally, after completing all iterations, the tip with the highest performance Will be the final output return.
[0041] Beneficial effects:
[0042] This patent proposes a Meta-Evidence-Aware Prompt Optimization (MEPO) method for large language models. This method utilizes clustering and Bayesian reasoning to perform a sophisticated analysis of causal relationships within evidence. First, MEPO generates preliminary evidence to describe the shortcomings of a given prompt. Then, this preliminary evidence is clustered to eliminate redundant information, and Bayesian inference is used to obtain cluster center probabilities. The causal relationship between each pair of evidence is modeled to form a directed acyclic graph (DAG). Furthermore, this patent applies the maximum spanning tree algorithm to construct the DAG, thereby enhancing the reasoning capabilities of LLMs. Finally, this patent edits the initial prompts based on the obtained meta-evidence and employs beam search to select the best-performing prompt. Experimental results demonstrate that the MEPO method demonstrates good performance across multiple tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 Optimized instructions for prompts of PO and HPO methods;
[0044] Figure 2 Schematic overview of the MEPO method of the present invention. DETAILED DESCRIPTION
[0045] The following is a detailed description of the technical solution of the application in conjunction with the accompanying drawings. The described embodiments are only part of the embodiments involved in this patent. All non-innovative embodiments based on this embodiment by other researchers in this field fall within the scope of protection of this patent.
[0046] Solution Overview:
[0047] Assumptions represents a set of independent and identical training data, where and Representing the times input and output information, Represents the initial prompt, all prompts All from language space The goal of the prompt optimization task is to improve the prompt To generate the best prompt ,in is the metric function .
[0048] Figure 2 shows the overall architecture of MEPO. First, given the initial prompt , this patent generates preliminary evidence , as a shortcoming of the prompt. Secondly, this patent designs a meta-evidence identification method to capture causal relationships. Finally, this patent applies the prompt optimization mechanism of evidence identification to screen out the best performing prompts.
[0049] Step 1: Generate preliminary evidence;
[0050] When facing a given task, it is difficult for a large language model to produce the target result in one iteration. To solve this problem, this patent introduces preliminary evidence As feedback to the model, it points out the shortcomings of the current prompt. Specifically, this patent converts small batch data into As a reminder Input into the large language model to obtain the loss signal The initial evidence generation can be formalized as follows:
[0051]
[0052] As shown in Figure 2, preliminary evidence is presented in a continuous format, for example: the prompt may not be specific enough, not clear enough, etc. To enhance the relevance of the output, this patent limits the amount of evidence by adding prompts: giving five reasons why the prompts may misunderstand these examples.
[0053] Step 2: Binary evidence identification;
[0054] After generating preliminary evidence, similar evidence can be removed through clustering. Large language models often converge to local optima over multiple iterations due to a lack of causal analysis of the preliminary evidence. This patent uses Bayesian reasoning to capture causal relationships in the evidence.
[0055] Evidence group clustering
[0056] Given preliminary evidence , this patent adopts the embedded model Each piece of evidence Embedded into vector , as shown below:
[0057]
[0058] in Represents the evidence embedding set. Then, this patent applies the K-means algorithm to initialize Empty cluster, represented by Each cluster set Match an initial center The set of all centers can be defined as For each , this patent calculates its The Euclidean distance of all centers in Add to the nearest matching cluster After adding all points, this patent is updated as follows Each center :
[0059]
[0060] This patent repeats the iterative process until each cluster center set no longer changes. As shown in Figure 2, stage 2, preliminary evidence According to their distance from the cluster center, they are clustered into 3 cluster centers, namely 、 and .
[0061] Evidence causal relationship identification
[0062] In order to obtain the causal relationship between cluster centers, this patent constructs a set of cluster center pairs, denoted as Using the Bayesian method, this patent uses a large language model to infer the causal relationship between cluster center pairs. Specifically, for each cluster center pair , the prompt template designed by this patent is Given the feedback cluster center: , is it possible to infer the feedback cluster centers Is this also true? Answer yes or no. Then, this patent will Input a large language model and query from infer The probability is:
[0063]
[0064] in, represents the output of the large language model, is an indicator function that is equal to 1 if the condition is true. Find the probability of all center pairs in .
[0065] Building an evidence map
[0066] For each cluster center , this patent constructs a directed cluster center graph , where the edge weight is The maximum spanning tree algorithm (MST) is used to identify the subgraph with the largest sum of weights in the cluster center graph. Its form is
[0067]
[0068] in represent All possible spanning trees in It's the edge Finally, this patent will maximize the spanning tree Convert to a DAG, preserving the direction of edges and eliminating cycles in the graph. By vertex set and edge sets Composition, which is defined as follows:
[0069]
[0070] in, and .
[0071] As shown in Figure 2, stage 2, the three cluster centers It is eventually transformed into a DAG with the following causal relationships:
[0072] Step 3: Optimize evidence-aware prompts
[0073] Complexity metrics based on model parameter norms and outputs
[0074] The large language model generates refined prompts based on structured meta-evidence. From the current prompt Generate iteration 1 Candidate hints, denoted as Then, in iteration 2, for each , this patent instructs the large language model to generate additional candidate , they are variants of , keeping semantic similarity but different wording. Next, this patent marks the candidate hints of iteration 2 as This patent repeats the above process until the maximum number of iterations is reached. (This is a hyperparameter.) Iterations, candidate prompts It can be expressed as:
[0075]
[0076] in Finally, this patent will produce the last iteration of As the final evidential perception cue.
[0077] Tips Optimization
[0078] Once the initial hint is expanded into multiple candidate hints, the refinement step occurs in In the time step, select the front Candidate hints are left on the beam for the next iteration. This patent simulates this step as a multi-armed bandit problem. Specifically, In the iterations, this patent has Using enhanced upper confidence bound algorithm to select hints for:
[0079]
[0080] in, is the exploration parameter, Is the prompt The performance estimate of is the current time step From the prompt Then, in the sampled data set Evaluate selected prompts performance and calculate the reward Finally, after all iterations are completed, the highest performing tip Will be the final output return.
[0081] The above description is merely a preferred embodiment of the present invention and does not constitute any other form of limitation to the present invention. Any modification or equivalent variation based on the technical essence of the present invention shall still fall within the scope of protection claimed by the present invention.
Claims
1. A method for optimizing meta-evidence-aware prompts for a large language model, characterized in that: The specific steps are as follows: Step 1: Generate preliminary evidence; Step 2: Meta-evidence identification; The steps of binary evidence identification are as follows: After generating preliminary evidence, clustering is used to remove similar evidence and Bayesian reasoning is used to capture the causal relationship in the evidence; Evidence group clustering; Given preliminary evidence , using the embedding model Each piece of evidence Embedded into vector As shown below: ; in Represents the evidence embedding set, then, the K-means algorithm is applied to initialize Empty cluster, represented by , each cluster set Match an initial center , the set of all centers can be defined as ; For each , calculate its The Euclidean distance of all centers in Add to the nearest matching cluster After adding all points, update as follows Each center : ; Repeat the iterative process until each cluster center set no longer changes, in which the second stage, preliminary evidence According to their distance from the cluster center, they are clustered into 3 cluster centers, namely 、 and ; identification of causal relationships in evidence; In order to obtain the causal relationship between cluster centers, a set of cluster center pairs is constructed, which is recorded as , using the Bayesian method, through the large language model to infer the causal relationship between cluster center pairs, for each cluster center pair , the prompt template is Given the feedback cluster center: , is it possible to infer the feedback cluster centers is also true, answer yes or no, then, Input a large language model and query from infer The probability is: ; in, represents the output of the large language model, is an indicator function that is equal to 1 if the condition is true. Finally, Find the probability of all center pairs in ; Constructing evidence maps; For each cluster center , construct a directed cluster center graph , where the edge weight is , use the maximum spanning tree algorithm MST to identify the subgraph with the largest sum of weights in the cluster center graph, which is in the form of; ; in represent All possible spanning trees in It's the edge Finally, the maximum spanning tree Convert to a DAG, preserving the direction of edges and eliminating cycles in the graph, By vertex set and edge sets Composition, which is defined as follows: ; in, and ; In the second stage, three cluster centers It is eventually transformed into a DAG with the following causal relationships: ; Step 3: Optimize evidence-aware prompts; The step 3 of evidence perception prompt optimization is as follows: Complexity metrics based on model parameter norms and outputs; The large language model generates refined hints based on structured meta-evidence. First, the large language model generates refined hints based on From the current prompt Generate iteration 1 Candidate hints, denoted as ; Then, in iteration 2, for each , instructing the large language model to generate additional candidate ,yes Next, we label the candidate prompts for iteration 2 as , repeat the above process until the maximum number of iterations is reached , for the Iterations, candidate prompts It can be expressed as: ; in Finally, the last iteration produces As the final evidential perception cue; Tip optimization; Once the initial hint is expanded into multiple candidate hints, the refinement step occurs in In the time step, select the front Candidate hints remain on the beam for the next iteration, simulating this step as a multi-armed bandit problem. In each iteration, Select hints using enhanced upper confidence bound algorithm for: ; in, is the exploration parameter, Is the prompt The performance estimate of is the current time step From the prompt The number of queries, then, in the sampled data set Evaluate selected prompts performance and calculate the reward ,Finally, after completing all iterations, the tip with the highest performance Will be the final output return.
2. The method for optimizing meta-evidence-aware prompts for a large language model according to claim 1, characterized in that: The first step is to generate preliminary evidence, which is as follows: Preliminary evidence introduced As feedback to the model, the shortcomings of the current prompt are pointed out and the mini-batch data is As a reminder Input into the large language model to obtain the loss signal , the initial evidence generation can be formalized as follows: ; The preliminary evidence was presented in a sequential format, and to enhance the relevance of the output, the amount of evidence was limited by adding prompts: Give five reasons why the prompts would misunderstand the examples.
Citation Information
Patent Citations
Semantic relationship prediction method based on multi-section prompt optimization of large language model
CN119294399A
Intelligent system and method of optimizing natural language processing models
US20240370662A1