Integrated thinking chain prompting method, system, device and medium

By adopting the integrated thinking chain prompt method in a small-scale large language model, using similarity and diversity strategies to build a mixed problem set, and determining the answer through majority voting, the problem of insufficient compatibility of small-scale LLMs in thinking chain reasoning is solved. Improve inference performance and generalization.

CN118606728BActive Publication Date: 2024-12-27NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411085784.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-12-27
Estimated Expiration
2044-08-08

AI Technical Summary

Technical Problem

Small-scale large-language models are insufficient in the thinking chain reasoning prompt method, resulting in low inference performance for complex tasks. Existing research mostly adopts large-scale models, and complex prompt strategies cannot be compatible in small-scale LLMs.

Method used

Using the integrated thinking chain prompt method, determine the target problem set by receiving the target task, introduce similarity strategies, diversity strategies and partial replacement strategies to build a mixed problem set, construct a sample set based on the preset prompt strategy, and input it into the model to obtain Integrate a collection of thinking chains to determine the final answer through majority voting.

Benefits of technology

The inference performance of small-scale LLMs in complex tasks is improved, the compatibility and generalization of thinking chains are achieved, and the problem of poor performance of single-round Few-shot CoT's complex hint strategy in small-scale models is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118606728B_ABST
    Figure CN118606728B_ABST
Patent Text Reader

Abstract

This invention provides an integrated thought chain prompting method, system, device, and medium, relating to the field of thought chain prompting technology. Upon receiving a target task, a target question set is determined based on the target task; a hybrid question set is constructed by introducing similarity, diversity, and partial substitution strategies based on the target question set; a sample set is constructed from the hybrid question set according to a preset prompting strategy; input information is generated from the sample set and input into a preset model to obtain the model output; an integrated thought chain set is obtained from the model output, and the final answer corresponding to the integrated thought chain set is determined according to a majority voting principle. The similarity and diversity strategies reveal the model's preference for sample selection when facing different tasks, and the preset prompting strategy further achieves both generalization and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of thought chain prompting, and in particular to an integrated thought chain prompting method, system, device and medium. Background Art

[0002] Large language models (LLMs) have achieved remarkable results in solving natural language processing (NLP) tasks. Among them, reasoning is the process of using existing knowledge to think logically and draw conclusions. Reasoning using language models generally refers to informal deductive reasoning, that is, deriving conclusions from premises; if the premise is true, then the conclusion is true. Reasoning using language models has been a popular and long-standing research topic. Many studies have created datasets to evaluate the reasoning performance of LLMs on complex tasks. These datasets are mainly divided into three categories: arithmetic, common sense, and symbolic. Arithmetic datasets require models to apply mathematical concepts and rules to construct and solve equations, such as GSM8K, SVAMP, SingleEq, AddSub, MultiArith, and Aqua. Common sense datasets require models to judge or predict some statements based on world knowledge and common sense, such as CSQA and StrategyQA. Symbolic datasets require models to perform string operations under specific rules, for example, Last Letter and Coin Flip.

[0003] Chain of Thoughts (CoT), which requires the model to output reasoning steps before getting the final answer, can further improve the reasoning performance in complex tasks. For basic chain of thoughts, it is mainly divided into two categories. One is Few-shot Chain of Thoughts Reasoning (Few-shot CoT), which uses <question-reasoning path> as an example before a new input question. The other is Zero-shot CoT, which only uses "Let's think step by step" as a prompt. Generally speaking, Few-shot CoT with longer context performs better than Zero-shot CoT, and the latter has stronger generalization because it does not require manually designed examples.

[0004] Among the basic CoT methods, the key to Few-Shot CoT is sample selection, because improper selection can lead to insufficient context length or introduce noise in reasoning. Usually, the semantic relevance between the sample and the input question is considered, and samples are selected based on "similarity" or "diversity". "Similarity" refers to the similarity between the sample and the target question, while "diversity" refers to the degree of diversity between the samples. For different tasks, the model has different preferences between the two. For the first time, these two dimensions are comprehensively considered to select ideal samples in parallel.

[0005] There are still challenges and shortcomings in the current research on CoT. Small-scale LLMs are not suitable for the reasoning prompt method of thought chain, so most of the research on thought chain uses large-scale large language models, and complex thought chain prompt strategies may not be compatible with small-scale LLMs.

[0006] Therefore, how to improve the thinking chain while being compatible with a small-scale and large language model has become a technical problem that needs to be solved urgently. Summary of the invention

[0007] In order to improve the thought chain while being compatible with a small-scale and large language model, the present application provides an integrated thought chain prompt method, system, device and storage medium.

[0008] In the first aspect, the present application provides an integrated thinking chain prompting method using the following technical solution:

[0009] An integrated thinking chain prompting method, including:

[0010] Upon receiving the target task, determining a target problem set according to the target task;

[0011] According to the target problem set, similarity strategy, diversity strategy and partial replacement strategy are introduced to construct a mixed problem set;

[0012] constructing a sample set in the mixed problem set according to a preset prompt strategy;

[0013] Generate input information according to the sample set and input it into a preset model to obtain a model output result;

[0014] An integrated thought chain set is obtained from the model output result, and a final answer corresponding to the integrated thought chain set is determined according to a majority voting principle.

[0015] Optionally, before the step of introducing a similarity strategy, a diversity strategy and a partial replacement strategy according to the target problem set to construct a mixed problem set, the step further includes:

[0016] Obtaining task type information corresponding to the target task;

[0017] Perform matching in a local database according to the task type information and determine a matching result;

[0018] The target problem set is updated according to the matching result and the target task.

[0019] Optionally, the step of introducing a similarity strategy, a diversity strategy and a partial replacement strategy according to the target problem set to construct a mixed problem set includes:

[0020] Using Sentence-BERT to obtain vector information in the target problem set and the target task;

[0021] A K-Means clustering operation is performed according to the vector information, and a hybrid problem set is constructed by combining a similarity strategy, a diversity strategy and a partial replacement strategy.

[0022] Optionally, the step of performing a K-Means clustering operation according to the vector information and combining a similarity strategy, a diversity strategy and a partial replacement strategy to construct a mixed question set includes:

[0023] determining an optimal number of clusters using an elbow plot of the sum of squared errors in the vector information;

[0024] Performing a K-Means clustering operation according to the optimal number of clusters and obtaining an operation result;

[0025] Determine a similarity problem set according to the operation results and the similarity strategy;

[0026] Determine a diversity problem set based on the operation results and the diversity strategy;

[0027] Based on the similarity question set and the diversity question set, a mixed question set is obtained by adopting a partial replacement strategy.

[0028] Optionally, before the step of obtaining a mixed question set by adopting a partial replacement strategy based on the similarity question set and the diversity question set, the method further includes:

[0029] The distance information between the vectors in the similarity problem set and the diversity problem set is determined by means of cosine similarity.

[0030] Optionally, the step of constructing a sample set in the mixed problem set according to a preset prompt strategy includes:

[0031] Get the preset prompt strategy;

[0032] Generating a reasoning path result corresponding to each question in the mixed question set according to the preset prompt strategy;

[0033] Splicing the preset prompt strategy and the reasoning path result to generate a splicing result corresponding to each of the questions;

[0034] A sample set is constructed according to the splicing result.

[0035] Optionally, the step of generating input information according to the sample set and inputting the information into a preset model to obtain a model output result includes:

[0036] generating input information according to the sample set;

[0037] The input information is input into a preset model so that the preset model executes a target reasoning strategy on the input information and generates a model output result, wherein the preset model includes a large language model, and the target reasoning strategy includes a round of Few-shot CoT reasoning strategy.

[0038] In a second aspect, the present application provides an integrated thought chain prompting system, comprising:

[0039] A target problem set module, configured to determine a target problem set according to the target task when receiving the target task;

[0040] A mixed problem set module, used for introducing a similarity strategy, a diversity strategy and a partial replacement strategy according to the target problem set to construct a mixed problem set;

[0041] A sample set module, used for constructing a sample set in the mixed problem set according to a preset prompt strategy;

[0042] An output result module, used to generate input information according to the sample set and input it into a preset model to obtain a model output result;

[0043] The final answer module is used to obtain an integrated thought chain set from the model output result and determine the final answer corresponding to the integrated thought chain set according to the majority voting principle.

[0044] In a third aspect, the present application provides a computer device, comprising: a memory and a processor, wherein the processor executes the method described above when running computer instructions stored in the memory.

[0045] In a fourth aspect, the present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute the method described above.

[0046] In summary, the present application includes the following beneficial technical effects:

[0047] This application determines the target problem set according to the target task when receiving the target task; introduces similarity strategy, diversity strategy and partial replacement strategy according to the target problem set to construct a mixed problem set; constructs a sample set in the mixed problem set according to the preset prompt strategy; generates input information according to the sample set and inputs it into the preset model to obtain the model output result; obtains the integrated thinking chain set in the model output result and determines the final answer corresponding to the integrated thinking chain set according to the majority voting principle. The similarity strategy and diversity strategy reveal the model's preference for sample selection when facing different tasks, and the preset prompt strategy further achieves both generalization and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is a schematic diagram of the computer device structure of the hardware operating environment involved in the embodiment of the present application;

[0049] Figure 2 This is a flowchart of the first embodiment of the integrated thinking chain prompting method of the present application;

[0050] Figure 3 It is a specific implementation code diagram of constructing a mixed question set of the first embodiment of the integrated thinking chain prompting method of the present application;

[0051] Figure 4 This is the CoT integration diagram of the first embodiment of the integrated thinking chain prompting method of the present application;

[0052] Figure 5 It is a visualization diagram after clustering the problem data set of the first embodiment of the integrated thinking chain prompting method of the present application;

[0053] Figure 6 This is a graph showing the accuracy of different methods in arithmetic problems in the first embodiment of the integrated thinking chain prompting method of the present application;

[0054] Figure 7 This is a graph showing the accuracy of different methods for common sense questions in the first embodiment of the integrated thinking chain prompting method of the present application;

[0055] Figure 8 This is a graph showing the accuracy of different methods for symbolic questions in the first embodiment of the integrated thinking chain prompting method of the present application;

[0056] Fig. 9 This is a graph showing the accuracy of different methods for symbolic questions in the first embodiment of the integrated thinking chain prompting method of the present application;

[0057] Fig.10 It is a preference diagram of sample selection by different models under different data sets in the first embodiment of the integrated thinking chain prompting method of the present application;

[0058] Fig.11 This is the impact diagram of a single round of CoT on integration in the first embodiment of the integrated thinking chain prompting method of the present application; Fig.11 (a) is a diagram showing the impact of a single round of CoT on integration in arithmetic problems in the first embodiment of the integrated thinking chain prompting method of this application, Fig.11 (b) is a diagram showing the impact of a single round of CoT on integration in common sense and symbolic questions according to the first embodiment of the integrated thinking chain prompting method of the present application;

[0059] Fig.12 This is the answer change analysis diagram of the first embodiment of the integrated thinking chain prompt method of the present application;

[0060] Fig.13 This is a method comparison diagram of the first embodiment of the integrated thinking chain prompting method of the present application;

[0061] Fig.14 It is a structural block diagram of the first embodiment of the integrated thinking chain prompting system of the present application. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below through the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0063] Reference Figure 1 , Figure 1 A schematic diagram of the computer device structure of the hardware operating environment involved in the embodiment of the present application.

[0064] like Figure 1 As shown, the computer device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0065] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the computer device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0066] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a low-light target detection program.

[0067] exist Figure 1In the computer device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the present application can be set in the computer device, and the computer device calls the low-light target detection program stored in the memory 1005 through the processor 1001, and executes the integrated thinking chain prompt method provided in the embodiment of the present application.

[0068] The present application embodiment provides an integrated thinking chain prompting method, referring to Figure 2 , Figure 2 This is a flow chart of the first embodiment of the integrated thinking chain prompting method of this application.

[0069] In this embodiment, the integrated thinking chain prompting method includes the following steps:

[0070] Step S10: When receiving the target task, determine the target problem set according to the target task.

[0071] It should be noted that the concept of Chain-of-thought (CoT) was first proposed in Google's paper "Chain-of-Thought Prompting Elicits Reasoning in Large Language Models". Chain-of-thought (CoT) is an improved prompting strategy used to improve the performance of LLM in complex reasoning tasks, such as arithmetic reasoning, common sense reasoning, and symbolic reasoning. Chain-of-thought is a discrete prompt learning, contextual learning under a large model (that is, without training, adding examples to the front of the current sample input, allowing the model to input these texts at once to output and complete the task). Compared with the previous traditional contextual learning (that is, using x1, y1, x2, y2, ....xtest as input to let the large model complete the output ytest), Chain-of-thought has more intermediate derivation prompts.

[0072] It should be noted that the target task can be sent through a preset port, or can be determined by manually actively obtaining it.

[0073] In a specific implementation, determining the target problem set according to the target task means obtaining specific task information in the target task after receiving the target task. Determine the target problem set according to the specific information. In order to expand the space for subsequent sample selection, a larger problem set will be further generated according to the target problem set.

[0074] Step S20: Introduce similarity strategy, diversity strategy and partial replacement strategy according to the target problem set to construct a mixed problem set.

[0075] Furthermore, in order to effectively realize the acquisition of the hybrid problem set, before the step of introducing the similarity strategy, diversity strategy and partial replacement strategy to construct the hybrid problem set according to the target problem set, it also includes: obtaining the task type information corresponding to the target task; matching according to the task type information in the local database and determining the matching result; updating the target problem set according to the matching result and the target task.

[0076] It should be noted that the purpose of obtaining task type information is to select data sets under the same task type to expand the sample selection space. The address of the selected data set of the same task type can be a preset database or other address containing different data sets, which is not limited in this embodiment.

[0077] It is understandable that the task type information is matched in the local database and the matching result is obtained, and the target question set is updated according to the matching result combined with the target task. If the result matched according to the task type information in the local database is empty or does not meet the preset entry threshold, an error match signal will be generated. According to the error match signal, the question set can be obtained from other addresses. The specific order of magnitude of the selection space that needs to be expanded is not limited in this implementation.

[0078] Furthermore, in order to reasonably construct a mixed question set, the steps of introducing a similarity strategy, a diversity strategy and a partial replacement strategy to construct a mixed question set according to the target question set include: using the Sentence-BERT method to obtain vector information in the large language model target question set and the large language model target question; performing a K-Means clustering operation based on the large language model vector information, and combining the similarity strategy, the diversity strategy and the partial replacement strategy to construct a mixed question set.

[0079] It should be noted that the steps of performing K-Means clustering operation according to vector information and combining similarity strategy, diversity strategy and partial replacement strategy to construct a mixed problem set include:

[0080] The elbow diagram of the sum of squared errors is used in the vector information to determine the optimal number of clusters; the K-Means clustering operation is performed according to the optimal number of clusters and the operation results are obtained; the similarity problem set is determined according to the operation results combined with the similarity strategy; the diversity problem set is determined according to the operation results combined with the diversity strategy; based on the similarity problem set and the diversity problem set, a partial replacement strategy is used to obtain the mixed problem set.

[0081] It can be understood that before the step of obtaining a mixed question set by adopting a partial replacement strategy based on the similarity question set and the diversity question set, the method further includes: determining the distance information of the vectors in the similarity question set and the diversity question set by means of cosine similarity.

[0082] In the specific implementation, first, the data sets under the same task type are merged as the test problem set To expand the space for subsequent sample selection. Then traverse and select questions one by one as test questions That is, the target problem under the target task. The Sentence-BERT (Reimers and Gurevych 2019) method is used to obtain The vector representation of each problem in the cluster is then K-Means clustering is performed on the vectorized results. The optimal number of clusters for clustering Determined by the elbow plot using the Sum of Squared Errors (SSE). It is Clusters; yes Samples in No. The cluster centers of clusters:

[0083]

[0084] Next, the questions closest to the cluster center are extracted as the “question set based on diversity extraction” .distance Most recent Questions are extracted as "Question Sets Extracted Based on Similarity" . Use cosine similarity to measure the distance between two vectors, where A and B are both n-dimensional vectors in n-dimensional vector space:

[0085]

[0086] Then replace The End The question is Corresponding position questions to get Mixed Problem Sets , The smaller the value, the fewer questions are replaced and the higher the similarity between question sets. The specific code implementation is as follows: Figure 3 shown.

[0087] It should be noted that the similarity strategy in this embodiment refers to a question set extracted based on similarity; the diversity strategy refers to a question set extracted based on diversity.

[0088] Step S30: constructing a sample set in the mixed question set according to a preset prompt strategy.

[0089] Furthermore, in order to realize the construction of a sample set according to a preset prompt strategy, the step of constructing a sample set according to the preset prompt strategy in a mixed problem set includes: obtaining the preset prompt strategy; generating a reasoning path result corresponding to each problem in the mixed problem set according to the preset prompt strategy; splicing the preset prompt strategy and the reasoning path result to generate a splicing result corresponding to each problem; and constructing a sample set according to the splicing result.

[0090] It should be noted that the "Let's think step by step" prompt of Zero-shot CoT is used to set , and Each question in the above example obtains the corresponding reasoning path. After concatenating the question and the reasoning path, we get the following: In order to avoid the differences caused by the model, the reasoning path generated by GPT-3 was used for experiments.

[0091] In a specific implementation, the preset prompt strategy used in this embodiment is "Let's think step by step", and other preset prompt strategies may also be used, which is not limited in this embodiment.

[0092] Step S40: Generate input information according to the sample set and input it into the preset model to obtain the model output result.

[0093] It should be noted that the step of generating input information according to the sample set and inputting it into the preset model to obtain the model output result includes: generating input information according to the sample set; inputting the input information into the preset model so that the preset model executes the target reasoning strategy on the input information and generates the model output result, wherein the preset model includes a large language model, and the target reasoning strategy includes a round of Few-shot CoT reasoning strategy.

[0094] In the specific implementation, Figure 4 As shown, for each sample set, concatenate the test questions The CoT prompt "Let's think step by step" is used as the input of the large language model. A round of Few-shot CoT reasoning is performed on each input to obtain multiple reasoning paths and answers. Finally, a majority vote is performed on multiple answers, and the one with the most votes is taken as the final answer.

[0095] Step S50: Obtain an integrated thought chain set in the model output result and determine the final answer corresponding to the integrated thought chain set according to the majority voting principle.

[0096] In the specific implementation, in order to verify the effectiveness of this embodiment, an experiment will be conducted to test and evaluate the following data sets. According to the similarity of reasoning logic, arithmetic and common sense questions are combined into a question data set. and Treat the Last Letter and Coin Flip datasets separately as problem datasets and .

[0097] Arithmetic: AQuA (254), MultiArith (600), GSM8K (1319), AddSub (395), SingleEq (508), SVAMP (1000). Except for AQuA which is a multiple-choice question, the other datasets are short text question answering.

[0098] General knowledge: CSQA (1221) is a multiple-choice question; StrategyQA (2290) is a true-or-false question.

[0099] Arithmetic: Last Letter (500) is a short text question and Coin Flip (500) is a true or false question.

[0100] Model and parameter settings The models selected for the experiment are ChatGLM2-6B (Zeng et al. 2022) developed by Tsinghua University and Zhipu AI and Llama2-7B-chat (Touvron et al. 2023) developed by Meta. The default parameters Top k=50, Top p=1.0, Temperature=1.0 are used. , , and The number of clusters are 8, 5, 4, and 6 respectively. Figure 5 A visualization of the clustered problem dataset shown.

[0101] Benchmark methods,Zero-shot CoT and Few-shot CoT are mainly selected as benchmark methods for,comparison, and their descriptions are shown in Table 1.

[0102] Table 1: Description of the baseline methods The sample sets are obtained from "Question Set Based on Similarity Extraction", "Question Set Based on Diversity Extraction" and "Mixed Question Set", respectively. ”, “ "and" " represents the Few-shot CoT of a single round, and is represented by To represent Zero-shot CoT.

[0103] like Figures 6 to 9 As shown in the figure, the results of ChatGLM2-6B and Llama2-7B-chat under different CoT methods on 10 data sets are mainly presented. It can be observed that:

[0104] Except for Last Letter, the integrated results are higher than Zero-shot CoT and Few-shot CoT, proving the effectiveness and generalization of the method of this embodiment. In particular, ChatGLM2-6B and Llama2-7B-chat improve by an average of 9.9% and 2.9% in arithmetic, and 4.3% and 1.4% in common sense, respectively. In addition, the integrated result of ChatGLM2-6B is much larger than the second highest result in each row; in MultiArith, AddSub, SingleEq, and SVAMP, the improvements are all above 10%, while the average integrated result of Llama2-7B-chat improves by about 4%. This shows that different models have different sensitivities to the method of this implementation.

[0105] Except for Last Letter and AQuA, the Few-shot CoT accuracy of Llama2-7B-chat is more stable and higher than that of Zero-shot CoT. However, for ChatGLM2-6B, the accuracy of Zero-shot CoT results such as MultiArith, GSM8K, CSQA and SingleEq is better than that of Few-shot CoT.

[0106] Based on the results of multiple rounds of Few-shot CoT, and The best sample combination may not be achieved, and about 65% of the cases are mixed samples. Achieve the best.

[0107] Figure 6 :Accuracy of different methods on arithmetic problems (%) Each row represents the results of multiple rounds of LLM on a specific dataset. The best accuracy in each row is in bold, and the second best is in underline. Each column represents a CoT method, where Indicates Zero-shot CoT, ”, “ "and" ” represents Few-shot CoT based on different examples, and Integration represents the method of this embodiment;

[0108] Figure 7:The accuracy of different methods for common sense questions (%) ;

[0109] Figure 8 :The accuracy of different methods for symbolic questions (%) (Last Letter) ;

[0110] Fig. 9 :The accuracy of different methods for symbolic questions (%) (Coin Flip) .

[0111] It should be noted that after the result analysis, the preference of sample selection, such as Fig.10 The figure shows multiple rounds of Few-shot CoT. arrive Then The changing trend of accuracy when the corresponding sample changes from similarity to diversity. It can be inferred that LLM has a preference for sample selection under different data sets. The line graph of ChatGLM2-6B in MultiArith shows a downward trend, indicating that it prefers samples of "similarity", while Llama2-7B-chat in this data set is the opposite, preferring "diversity", indicating that even when facing the same data set, different models may have different sample selection preferences. In addition, the line graphs of Llama2-7B-chat in MultiArith and GSM8K gradually rise, while the line graphs of AddSub and SingleEq gradually decrease, indicating that even the same model facing the same task may have different sample preferences due to different data sets.

[0112] like Fig.11 The effect of a single round of CoT on the integration is shown. Fig.11 The effect of excluding each single round of CoT from the ensemble is illustrated. Dark colors indicate that the current round has a substantial positive impact on voting, while light colors indicate a negative impact. Fig.11 The dark or light shaded cells in Figures 6 to 9 For example, in Fig.11 The results of ChatGLM2-6B in Zero-shot CoT tend to be darker, indicating that it has a positive impact on integration and is consistent with Figures 6 to 9 In addition, the light-colored results of SVAMP, CSQA, StrategyQA, etc. of Llama2-7B-chat are similar to Figures 6 to 9 It can be concluded that the higher the accuracy of single-round reasoning, the more likely it is to improve the accuracy of integration. Fig.11: By excluding each round of CoT for 10 datasets, the changes in correctly answered questions after ensemble are analyzed. : Arithmetic data set; Common sense datasets; :Symbol Dataset (Last Letter); : Symbolic dataset (Coin Flip). Each row corresponds to a round of elimination, where Indicates that Zero-shot CoT is excluded. , and Indicates the exclusion of single-round Few-shot CoT according to different samples. The value of each cell is mapped from negative to positive, and the color is from light to dark, indicating that the positive effect of this round on integration is gradually weakened.

[0113] From Zero-shot CoT to Voting, we noticed that The ensemble result is not very effective, mainly because the model does not always follow the operating standards, resulting in the ensemble being a vote for incorrect answers. In this example, Zero-shot CoT is used as a comparison to see how the accuracy changes after ensemble. Fig.12 As shown, basically, the medium gray area is larger than the dark gray area, indicating that the ensemble successfully improves the accuracy of Zero-shot CoT, while the dark gray area exists, indicating that the ensemble fails to cover all possible correctly answered questions. In addition, Llama2-7B-chat (right) has a larger improvement than ChatGLM2-6B (left). Fig.12 :Analysis of the change of answers from Zero-shot CoT to Integration in 10 datasets (left: ChatGLM2-6B; right: Llama2-7B-chat). wrong→wrong: Both Zero-shot CoT and Integration cannot answer correctly. wrong→correct: Integration changes the wrongly answered questions in Zero-shot CoT to correct ones; correct→wrong: Integration changes the correctly answered questions in Zero-shot CoT to wrong ones.

[0114] In contrast to large-scale language models, this example uses Integration to compare the results of ChatGLM2-6B and Llama2-7B-chat with the results of GPT-3.5 using the baseline method (Zou et al. 2023). Fig.13As shown in the figure, GPT-3.5 outperforms ChatGLM2-6B and Llama2-7B-chat on arithmetic and symbolic tasks. ChatGLM2-6B shows high performance in common sense tasks, performs best in StrategyQA, and performs second in CSQA. Llama2-7B-chat is equivalent to GPT-3.5 only in StrategyQA and Coin Flip.

[0115] It can be understood that in this work, this embodiment proposes an integrated thinking chain prompting method based on mixed examples of small-scale LLM, which automatically realizes example selection, mixing and thinking chain integration. This method is simple, effective and versatile, and its results can also be used to guide the selection of ideal examples in Few-shot CoT. ChatGLM2-6B and Llama2-7B-chat are used to conduct experiments on a large number of complex reasoning tasks. The results show that the integrated system outperforms Zero-shot CoT and single-round Few-shot CoT.

[0116] The method of this embodiment has three main advantages. First, it relies on multi-round but direct Few-shot CoT, avoiding the poor performance when using a single-round but complex prompt strategy when using a small-scale LLM. Second, in Few-shot CoT, the samples of each round are biased towards "diversity" or "similarity" to varying degrees, so the results of multiple rounds can reveal the model's preference for sample selection when facing different tasks. In addition, only "let's think step by step" is used, without manually designing samples for specific tasks, which makes this method both generalizable and accurate.

[0117] This embodiment determines the target problem set according to the target task when receiving the target task; introduces similarity strategy, diversity strategy and partial replacement strategy according to the target problem set to construct a mixed problem set; constructs a sample set according to the preset prompt strategy in the mixed problem set; generates input information according to the sample set and inputs it into the preset model to obtain the model output result; obtains the integrated thinking chain set in the model output result and determines the final answer corresponding to the integrated thinking chain set according to the majority voting principle. The similarity strategy and diversity strategy reveal the model's preference for sample selection when facing different tasks, and the preset prompt strategy further achieves both generalization and accuracy.

[0118] In addition, an embodiment of the present application further proposes a computer-readable storage medium, on which a program for low-light target detection is stored. When the program for low-light target detection is executed by a processor, the steps of the method for low-light target detection as described above are implemented.

[0119] Reference Fig.14 , Fig.14This is a structural block diagram of the first embodiment of the integrated thought chain prompting system of this application.

[0120] like Fig.14 As shown, the integrated thinking chain prompting system proposed in the embodiment of the present application includes:

[0121] A target problem set module 10 is used to determine a target problem set according to the target task when receiving the target task;

[0122] A mixed question set module 20, used to determine a test question set according to a target question set and introduce a similarity strategy, a diversity strategy and a partial replacement strategy to construct a mixed question set;

[0123] A sample set module 30, used to construct a sample set in a mixed problem set according to a preset prompt strategy;

[0124] An output result module 40 is used to generate input information according to the sample set and input it into a preset model to obtain a model output result;

[0125] The final answer module 50 is used to obtain the integrated thought chain set in the model output result and determine the final answer corresponding to the integrated thought chain set according to the majority voting principle.

[0126] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present application. In specific applications, technicians in this field can make settings as needed, and the present application does not impose any limitation on this.

[0127] This embodiment determines the target problem set according to the target task when receiving the target task; introduces similarity strategy, diversity strategy and partial replacement strategy according to the target problem set to construct a mixed problem set; constructs a sample set according to the preset prompt strategy in the mixed problem set; generates input information according to the sample set and inputs it into the preset model to obtain the model output result; obtains the integrated thinking chain set in the model output result and determines the final answer corresponding to the integrated thinking chain set according to the majority voting principle. The similarity strategy and diversity strategy reveal the model's preference for sample selection when facing different tasks, and the preset prompt strategy further achieves both generalization and accuracy.

[0128] In one embodiment, the mixed problem set module 20 is further used to obtain task type information corresponding to the target task; perform matching in the local database according to the task type information and determine the matching result; and update the target problem set according to the matching result combined with the target task.

[0129] In one embodiment, the hybrid question set module 20 is also used to obtain vector information in the target question set and the target task using the Sentence-BERT method; perform a K-Means clustering operation based on the vector information, and construct a hybrid question set by combining a similarity strategy, a diversity strategy, and a partial replacement strategy.

[0130] In one embodiment, the mixed problem set module 20 is also used to determine the optimal number of clusters using the elbow diagram of the sum of squared errors in the vector information; perform a K-Means clustering operation based on the optimal number of clusters and obtain the operation result; determine a similarity problem set based on the operation result in combination with a similarity strategy; determine a diversity problem set based on the operation result in combination with a diversity strategy; and obtain a mixed problem set based on the similarity problem set and the diversity problem set using a partial replacement strategy.

[0131] In one embodiment, the mixed question set module 20 is further used to determine the distance information between the vectors in the similarity question set and the diversity question set by means of cosine similarity.

[0132] In one embodiment, the sample set module 30 is also used to obtain a preset prompt strategy; generate a reasoning path result corresponding to each question in the mixed question set according to the preset prompt strategy; splice the preset prompt strategy and the reasoning path result to generate a splicing result corresponding to each question; and construct a sample set according to the splicing result.

[0133] In one embodiment, the output result module 40 is also used to generate input information based on the sample set; input the input information into a preset model so that the preset model executes a target reasoning strategy on the input information and generates a model output result, wherein the preset model includes a large language model, and the target reasoning strategy includes a round of Few-shot CoT reasoning strategy.

[0134] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present application. In practical applications, technicians in this field can select part or all of it according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.

[0135] In addition, for technical details not described in detail in this embodiment, please refer to the method for low-light target detection provided in any embodiment of the present application, and will not be repeated here.

[0136] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0137] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0138] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application. The above is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, is also included in the patent protection scope of the present application.

Claims

1. An integrated thinking chain prompting method, characterized in that: include: Upon receiving the target task, determining a target problem set according to the target task; According to the target problem set, similarity strategy, diversity strategy and partial replacement strategy are introduced to construct a mixed problem set; constructing a sample set in the mixed problem set according to a preset prompt strategy; Generate input information according to the sample set and input it into a preset model to obtain a model output result; Obtaining an integrated thought chain set from the model output result and determining a final answer corresponding to the integrated thought chain set according to a majority voting principle; The step of introducing similarity strategy, diversity strategy and partial replacement strategy to construct a mixed problem set according to the target problem set includes: Using Sentence-BERT to obtain vector information in the target problem set and the target task; Performing a K-Means clustering operation according to the vector information, and combining a similarity strategy, a diversity strategy, and a partial replacement strategy to construct a mixed problem set; The step of performing a K-Means clustering operation according to the vector information and combining a similarity strategy, a diversity strategy and a partial replacement strategy to construct a mixed problem set includes: determining an optimal number of clusters using an elbow plot of the sum of squared errors in the vector information; Performing a K-Means clustering operation according to the optimal number of clusters and obtaining an operation result; Determine a similarity problem set according to the operation results and the similarity strategy; Determine a diversity problem set based on the operation results and the diversity strategy; Based on the similarity problem set and the diversity problem set, a mixed problem set is obtained by adopting a partial replacement strategy; Before the step of obtaining a mixed question set by adopting a partial replacement strategy based on the similarity question set and the diversity question set, the method further includes: The distance information between the vectors in the similarity problem set and the diversity problem set is determined by means of cosine similarity.

2. The integrated thinking chain prompting method according to claim 1 is characterized in that: Before the step of introducing similarity strategy, diversity strategy and partial replacement strategy according to the target problem set to construct a mixed problem set, the method further includes: Obtaining task type information corresponding to the target task; Perform matching in a local database according to the task type information and determine a matching result; The target problem set is updated according to the matching result and the target task.

3. The integrated thinking chain prompting method according to claim 1 is characterized in that: The step of constructing a sample set according to a preset prompt strategy in the mixed problem set includes: Get the preset prompt strategy; Generating a reasoning path result corresponding to each question in the mixed question set according to the preset prompt strategy; Splicing the preset prompt strategy and the reasoning path result to generate a splicing result corresponding to each of the questions; A sample set is constructed according to the splicing result.

4. The integrated thought chain prompting method according to claim 1 is characterized in that: The step of generating input information according to the sample set and inputting it into a preset model to obtain a model output result includes: generating input information according to the sample set; The input information is input into a preset model so that the preset model executes a target reasoning strategy on the input information and generates a model output result, wherein the preset model includes a large language model, and the target reasoning strategy includes a round of Few-shot CoT reasoning strategy.

5. An integrated thinking chain prompt system, characterized in that: include: A target problem set module, configured to determine a target problem set according to the target task when receiving the target task; A mixed problem set module, used for introducing a similarity strategy, a diversity strategy and a partial replacement strategy according to the target problem set to construct a mixed problem set; A sample set module, used for constructing a sample set in the mixed problem set according to a preset prompt strategy; An output result module, used to generate input information according to the sample set and input it into a preset model to obtain a model output result; A final answer module, used to obtain an integrated thought chain set from the model output result and determine a final answer corresponding to the integrated thought chain set according to a majority voting principle; The mixed question set module is used to obtain vector information in the target question set and the target task by using Sentence-BERT; Performing a K-Means clustering operation according to the vector information, and combining a similarity strategy, a diversity strategy, and a partial replacement strategy to construct a mixed problem set; The hybrid problem set module is used to determine the optimal number of clusters using an elbow diagram of the sum of squared errors in the vector information; Performing a K-Means clustering operation according to the optimal number of clusters and obtaining an operation result; Determine a similarity problem set according to the operation results and the similarity strategy; Determine a diversity problem set based on the operation results and the diversity strategy; Based on the similarity problem set and the diversity problem set, a mixed problem set is obtained by adopting a partial replacement strategy; The mixed question set module is used to determine the distance information between the vectors in the similarity question set and the diversity question set by means of cosine similarity.

6. A computer device, characterized in that: The device comprises: a memory and a processor, wherein the processor executes the method according to any one of claims 1 to 4 when running computer instructions stored in the memory.

7. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computer, cause the computer to execute the method according to any one of claims 1 to 4.