Question and answer method and device based on thought chain, equipment and storage medium

By introducing a thought chain template corresponding to the target problem into a large-scale reasoning model, and controlling the reasoning steps and the number of lexical units, the overthinking problem of large-scale reasoning models is solved, and efficient and accurate answer reasoning and model optimization are achieved.

CN122491470APending Publication Date: 2026-07-31CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MOBILE COMM LTD RES INST
Filing Date
2026-03-31
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing large-scale reasoning models suffer from generating excessively long reasoning trajectories during the reasoning process, leading to overthinking phenomena such as repeated explanations of the question stem, redundant content, and frequent switching of reasoning approaches, which affects the efficiency and accuracy of the model.

Method used

After obtaining the target question, target prompts are determined, including the target thought chain template corresponding to the target question domain. These are then input into the large language model to guide the model in answer reasoning, ensuring that the reasoning steps and the number of lexical units are within a preset range. The target thought chain template is constructed to control the length of the reasoning trajectory.

Benefits of technology

Effectively compress and optimize the thought process of large-scale reasoning models, ensuring the accuracy and efficiency of the reasoning process, alleviating the problem of overthinking, and improving the generalization performance and versatility of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122491470A_ABST
    Figure CN122491470A_ABST
Patent Text Reader

Abstract

This application relates to the field of artificial intelligence technology, and provides a question-answering method, apparatus, device, and storage medium based on thought chain. The method includes: acquiring a target question; determining target prompt words for the target question based on the target question; the target prompt words include a target thought chain template corresponding to the domain of the target question, and the number of lexical units corresponding to the target thought chain template is within a preset range; inputting the target question and the target prompt words into a first large language model, and guiding the first large language model to reason about the answer to the target question through the target thought chain template in the target prompt words, thereby determining the target problem-solving approach corresponding to the target question; the number of lexical units corresponding to the target problem-solving approach is within the preset range. The question-answering method based on thought chain provided by this application can ensure that the reasoning trajectory is within a certain range, avoiding overthinking by the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a question-answering method, apparatus, device, and storage medium based on thought chain. Background Technology

[0002] Chain of Thought (CoT) is a technology that enhances the ability of large language models to solve complex problems through step-by-step logical reasoning. This technology guides the model to generate intermediate reasoning processes by manually adding step-by-step examples and other prompts, breaking down complex problems into logically related sub-steps and finally integrating them into a complete problem-solving chain.

[0003] Among related technologies, large reasoning models (LRMs), represented by DeepSeek-R1 and OpenAI o1, significantly improve model performance by extending the length of the thought chain during the reasoning process.

[0004] However, the above techniques have the problem of generating excessively long reasoning trajectories, which can lead to overthinking in the model, such as repeatedly explaining the question stem to generate redundant content, over-analyzing simple questions, and frequently switching reasoning approaches for difficult questions. Summary of the Invention

[0005] This application provides a question-answering method, apparatus, device, and storage medium based on thought chain to solve the technical problem that the existing technology generates excessively long reasoning trajectories, which leads to overthinking in the model.

[0006] Firstly, embodiments of this application provide a question-and-answer method based on thought chains, including: Identify the target problem; Based on the target question, target prompts are determined for the target question; the target prompts include target thinking chain templates for the corresponding domain of the target question, and the number of word elements corresponding to the target thinking chain templates is within a preset range; The target question and target prompt words are input into the first language model. The target thinking chain template in the target prompt words guides the first language model to reason about the answer to the target question and determine the target problem-solving approach corresponding to the target question. The number of lexical units corresponding to the above target problem-solving approach is within the preset range.

[0007] In one embodiment, determining the target prompts for the target question based on the target question includes: Based on the target problem, determine the target domain corresponding to the target problem; Based on the target domain, a target thinking chain template corresponding to the target domain is determined in the first correspondence relationship; the first correspondence relationship includes at least one domain and a thinking chain template corresponding to each domain. Based on the target mind chain template, identify target prompts for the target problem.

[0008] In one embodiment, the above-mentioned target thinking chain template is constructed in the following ways: Obtain multiple sample problems in the domain corresponding to the target problem, as well as sample problem-solving approaches for each sample problem; Based on each sample problem and the corresponding sample problem-solving approach, determine the target thinking chain template for the domain corresponding to the target problem.

[0009] In one embodiment, the above-mentioned determination of the target thinking chain template for the corresponding domain of the target problem based on each sample problem and the corresponding sample problem-solving approach includes: Based on each sample problem, determine the first sample problem-solving approach with the longest solution and the second sample problem-solving approach with the shortest solution among all sample problem-solving approaches; Based on the problem-solving approaches of the first and second samples, determine the target thinking chain template for the corresponding domain of the target problem.

[0010] In one embodiment, determining the target thinking chain template for the domain corresponding to the target problem based on the problem-solving approaches of the first and second samples includes: Based on the first problem-solving constraints in the domain corresponding to the target problem, the sample problems corresponding to the first sample problem-solving approaches, and the sample problems corresponding to the second sample problem-solving approaches, a first meta-plan template is constructed to extract prompt words; the first problem-solving constraints include the constraint that the word elements corresponding to the meta-plan thinking chain templates extracted from each sample problem-solving approach are within a preset number range; The prompt words extracted from the first-dimensional plan template and the problem-solving ideas from the first sample are input into the second large language model. The prompt words extracted from the first-dimensional plan template guide the second large language model to extract the first-dimensional plan thinking chain template from the problem-solving ideas from the first sample. The prompt words extracted from the first-dimensional plan template and the problem-solving ideas from the second sample are input into the second large language model. The prompt words extracted from the first-dimensional plan template guide the second large language model to extract the second-dimensional plan thinking chain template from the problem-solving ideas from the second sample. Based on the first and second elemental plan thinking chain templates, determine the target thinking chain template for the corresponding domain of the target problem.

[0011] In one embodiment, determining the target thinking chain template for the domain corresponding to the target problem based on the first-dimensional planning thinking chain template and the second-dimensional planning thinking chain template includes: Based on the second problem-solving constraints, the first meta-planning thought chain template, and the second meta-planning thought chain template corresponding to the target problem, construct the second meta-planning template to extract prompt words; the above-mentioned second problem-solving constraints include constraining the word elements corresponding to the general meta-planning thought chain template extracted from each meta-planning thought chain template to be within a preset number range; The second meta-plan template extraction prompts, the first sample problem-solving approach, and the second sample problem-solving approach are input into the second large language model. The second meta-plan template extraction prompts guide the second large language model to extract the general meta-plan thinking chain template from the first sample problem-solving approach and the second sample problem-solving approach. Based on the general meta-plan thinking chain template, determine the target thinking chain template for the corresponding domain of the target problem.

[0012] In one embodiment, determining the longest first sample problem-solving approach and the shortest second sample problem-solving approach among the sample problem-solving approaches includes: Each sample problem is classified to determine the corresponding subdomain category; each subdomain category belongs to the subdomain category under the domain corresponding to the target problem. Based on the subdomain category corresponding to each sample problem, group the sample problems belonging to the same subdomain category and their corresponding sample problem-solving approaches together to obtain the dataset corresponding to each subdomain category; For each subdomain category, determine the first sample solution with the longest solution and the second sample solution with the shortest solution in the dataset.

[0013] In one embodiment, the above-described classification process for each sample question to determine the sub-domain category corresponding to each sample question includes: Based on the classification system of the target problem's corresponding domain, determine the multiple sub-domain categories corresponding to the target problem's corresponding domain; Construct category suggestions based on each sub-domain category; Based on the sample questions, classification prompts, and the third language model, the sample questions are classified to determine the sub-domain category corresponding to each sample question.

[0014] In one embodiment, determining the target thinking chain template for the domain corresponding to the target problem based on the problem-solving approaches of the first and second samples includes: For each sub-domain category, based on the problem-solving approaches of the first and second samples in the dataset, determine the general meta-planning mind chain template for the sub-domain category. Based on the general meta-planning mind chain template corresponding to each sub-domain category, determine the target mind chain template for the domain corresponding to the target problem.

[0015] Secondly, embodiments of this application provide a question-answering device based on a thought chain, comprising: The problem retrieval module is used to retrieve the target problem; The thought chain prompt word determination module is used to determine target prompt words for the target question based on the target question; the target prompt words include target thought chain templates for the corresponding domain of the target question, and the number of word elements corresponding to the target thought chain templates is within a preset range; The answer module is used to input the target question and target prompt words into the first language model. The target thinking chain template in the target prompt words guides the first language model to reason about the answer to the target question and determine the target problem-solving approach corresponding to the target question. The number of lexical units corresponding to the above target problem-solving approach is within a preset range.

[0016] Thirdly, embodiments of this application provide a device, including a memory, a transceiver, and a processor; A memory for storing computer programs; a transceiver for sending and receiving data under the control of the processor; and a processor for reading the computer programs from the memory and performing the following operations: Identify the target problem; Based on the target question, target prompts are determined for the target question; the target prompts include target thinking chain templates for the corresponding domain of the target question, and the number of word elements corresponding to the target thinking chain templates is within a preset range; The target question and target prompt words are input into the first language model. The target thinking chain template in the target prompt words guides the first language model to reason about the answer to the target question and determine the target problem-solving approach corresponding to the target question. The number of lexical units corresponding to the above target problem-solving approach is within the preset range.

[0017] Fourthly, embodiments of this application provide an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the steps of the thought chain-based question-and-answer method described in the first aspect.

[0018] Fifthly, embodiments of this application provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the question-and-answer method based on thought chain described in the first aspect.

[0019] In a sixth aspect, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the steps of the thought chain-based question-and-answer method described in the first aspect.

[0020] The question-answering method, apparatus, device, and storage medium based on thought chain provided in this application embodiment obtain a target question and determine target prompt words for the target question accordingly. The target question and target prompt words are input into a first large language model. The first large language model is guided to perform answer reasoning on the target question through the target thought chain template in the target prompt words to determine the target problem-solving approach corresponding to the target question. The target prompt words include a target thought chain template in the domain corresponding to the target question. The number of word elements corresponding to the target thought chain template is within a preset number range, and the number of word elements corresponding to the target problem-solving approach is within a preset number range. This method introduces a thought chain template corresponding to the target problem's domain during the model reasoning stage to guide the model's answer reasoning. Since the number of lexical units in the thought chain template is within a preset range, the length of the reasoning trajectory generated by the model during answer reasoning is controllable, and the reasoning process is sufficiently accurate. This allows for efficient compression and optimization of the thought chain of large-scale reasoning models, alleviating the problem of overthinking while ensuring the model's reasoning accuracy. Furthermore, since the method introduces a thought chain template corresponding to the target problem's domain during model reasoning, which can be any domain, it has greater versatility and stronger generalization performance. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 This is a flowchart illustrating the question-answering method based on thought chain provided in an embodiment of this application; Figure 2 This is a schematic diagram of the first-dimensional plan template extraction prompts provided in the embodiments of this application; Figure 3 This is a schematic diagram of extracting prompt words from the constructed second-dimensional plan template provided in the embodiments of this application; Figure 4 This is a schematic diagram of the generated general meta-plan mind chain template provided in the embodiments of this application; Figure 5 This is a schematic diagram of the constructed classification prompt words provided in the embodiments of this application; Figure 6 This is a distribution chart showing the percentage of sub-domain categories provided in the embodiments of this application; Figure 7This is a schematic diagram of the overall process of the question-answering method based on the thought chain provided in the embodiments of this application; Figure 8 These are system prompt words for the general meta-planning mind chain template incorporating the mathematical field, provided in the embodiments of this application; Figure 9 This is a schematic diagram of the structure of the question-and-answer device based on the thought chain provided in the embodiments of this application; Figure 10 This is a schematic diagram of the structure of the device provided in the embodiments of this application; Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0024] Currently, large reasoning models (LRMs), represented by DeepSeek-R1 and OpenAI o1, significantly improve model performance by extending the length of the thought process during reasoning. However, this technique suffers from the problem of generating excessively long reasoning trajectories, leading to overthinking phenomena such as repeatedly interpreting the question stem to generate redundant content, over-analyzing simple problems, and frequently switching reasoning approaches for difficult problems. These inefficient reasoning patterns pose significant challenges to model training, inference, and practical deployment. Therefore, optimizing the thought process of large reasoning models has become a key focus in the industry. Several techniques have proposed training methods for large-scale models using thought chain compression for rewriting tasks. These methods first concatenate the multi-turn dialogue history and the current question in a first training dataset, and then replace the corresponding content in a thought chain prompt template with the concatenated result to obtain prompts. The first training dataset includes multi-turn dialogue history, the current question, and the standard answer. The thought chain prompt template is a multi-turn dialogue text completer that analyzes and returns referential content in the current input by combining historical input and output. The prompts are then input into a large model to generate a thought process. Based on this thought process and the first training dataset, a second training dataset is generated, where the thought process is divided into multiple stages. The large model is then trained on the second training dataset, with a hierarchical, progressive removal of certain thought processes from the second training dataset during training. However, this method is only applicable to rewriting tasks and increases the model's training cost, making it difficult to deploy in real-world applications.

[0025] As can be seen from the above description, current related technologies mainly focus on specific tasks, such as rewriting tasks, while in practical applications, user problems involve a wider range of reasoning tasks. Furthermore, current related technologies emphasize compressing thought processes during the model training phase, without exploring ways to alleviate the problem of overthinking during the inference phase.

[0026] Based on this, embodiments of this application provide a question-answering method, apparatus, device, and storage medium based on thought chain, which can solve the above-mentioned technical problems and is intended to be applicable to a wider range of reasoning tasks. The general meta-plan extraction process can be extended to data in any domain and does not require additional fine-tuning training. Therefore, it can more efficiently compress and optimize the thought chain of large-scale reasoning models, and alleviate the problem of overthinking of the model while ensuring accuracy.

[0027] It should be noted that the execution subject of the embodiments of this application can be a question-and-answer device based on the thought chain, or it can be an electronic device, or it can be other devices or equipment, etc. There is no specific limitation here. The following embodiments will use an electronic device as the execution subject for illustration.

[0028] Figure 1 This is a flowchart illustrating the question-answering method based on thought chain provided in the embodiments of this application. (Refer to...) Figure 1 The method may include the following steps: Step 102: Obtain the target problem.

[0029] The target question can be a question entered by the user or a question imported from a pre-configured question library. The target question is typically a single question, such as "How to calculate a certain math problem?"

[0030] Step 104: Based on the target question, determine the target prompt words for the target question; the target prompt words include the target thinking chain template corresponding to the target question, and the number of word elements corresponding to the target thinking chain template is within a preset range.

[0031] In this step, after obtaining the target problem, the target problem generally has a corresponding subject area, such as mathematics, chemistry, physics, etc., or the target problem can correspond to a more subdivided subfield within a specific subject area, such as the target problem belonging to the algebra subfield under mathematics.

[0032] Specifically, after obtaining the target question, we can first identify the subject area corresponding to the target question through a large language model, obtain the field corresponding to the target question, and then construct a general problem-solving approach for reasoning the answer to the question in the corresponding field, forming a general thinking chain template for the corresponding field, which serves as the target thinking chain template for the target question.

[0033] Alternatively, based on the target question, a target domain can be determined; based on the target domain, a target thinking chain template corresponding to the target domain can be determined in a first correspondence relationship; the first correspondence relationship includes at least one domain and a thinking chain template corresponding to each domain; and target prompt words for the target question can be determined based on the target thinking chain template. In other words, general thinking chain templates for different domains can be pre-constructed, and each domain and its general thinking chain template can be bound together to obtain a first correspondence relationship. When using this first correspondence relationship, the subject domain corresponding to the target question can be identified first through a large language model to obtain the domain corresponding to the target question, denoted as the target domain; then, the general thinking chain template corresponding to the target domain can be found in the first correspondence relationship, denoted as the target thinking template. Here, by finding the corresponding thinking chain template in the correspondence relationship based on the domain of the question to construct prompt words for the corresponding domain, the efficiency and accuracy of constructing prompt words for the domain corresponding to the target question can be improved.

[0034] It should be noted that the domain corresponding to the target problem identified above can be the subject area corresponding to the target problem, or it can be a sub-domain under the subject area corresponding to the target problem.

[0035] Furthermore, both the directly constructed target thought chain template and the target thought chain template found in the first correspondence relationship include multiple reasoning steps. Each reasoning step may include one or more word tokens. The total number of word tokens included in these multiple reasoning steps is within a preset range. This limits the reasoning steps or thinking process of the model to a certain range, avoiding overthinking. At the same time, the above-mentioned target thought chain template is a general thought chain template for solving problems in the domain corresponding to the target problem, which can ensure the accuracy of the answer obtained during model reasoning. The preset range may include a range formed by two quantity thresholds, or it may include a single quantity threshold. For example, a quantity threshold of 1024 can be set. If the number of word tokens included in the above-mentioned target thought chain template is less than or equal to 1024, it means that the number of word tokens included in the target thought chain is within the preset range.

[0036] Furthermore, after obtaining the target thought chain template for the domain corresponding to the target question, this template can be added to the existing prompts to obtain the target prompt. The existing prompts can include operation instructions that the first language model needs to execute, such as instructing the first language model to reason about the answer according to the target thought chain template, or they can include other content, such as restricting the first language model to output only answer-related content and not other irrelevant content.

[0037] Step 106: Input the target question and target prompt words into the first language model. Guide the first language model to reason about the answer to the target question through the target thought chain template in the target prompt words, and determine the target problem-solving approach corresponding to the target question; the number of lexical units corresponding to the above target problem-solving approach is within the preset range.

[0038] In this step, after obtaining the target question and its corresponding target hints, both can be input into the first language model. The first language model, based on the content of the target question and following the thought process of the target thought chain template in the target hints, will proceed step-by-step to reason and deduce the answer to the target question, ultimately obtaining the problem-solving approach and answer corresponding to the target thought chain template. The obtained problem-solving approach and answer can be recorded as the target problem-solving approach and the target answer. The target answer can be a summary of the target problem-solving approach.

[0039] The target problem-solving approach obtained above includes multiple problem-solving steps corresponding to the target thinking chain template. Each problem-solving step may include one or more word units. The total number of word units included in these multiple problem-solving steps is within a preset range, such as less than or equal to 1024 word units. This can limit the problem-solving steps or thinking process of the model reasoning to a certain range and avoid the model overthinking.

[0040] In addition, the first major language model mentioned above can be of the same type as the major language model used when constructing the target thinking chain template corresponding to the target problem in the subsequent process. For example, it can be the QwQ-32B open-source major language model, whose output is relatively concise.

[0041] In this embodiment, a target question is obtained and target prompt words are determined accordingly. The target question and target prompt words are then input into a first large language model. The target thought chain template in the target prompt words guides the first large language model to reason about the answer to the target question and determine the target problem-solving approach. The target prompt words include a target thought chain template for the domain corresponding to the target question. The number of lexical units corresponding to the target thought chain template and the number of lexical units corresponding to the target problem-solving approach are both within a preset range. This method, by introducing a thought chain template for the domain corresponding to the target question into the model reasoning stage to guide the model's answer reasoning, and ensuring that the number of lexical units in the thought chain template is within a preset range, guarantees that the length of the reasoning trajectory generated by the model during the answer reasoning process is controllable and the reasoning process is sufficiently accurate. This allows for efficient compression and optimization of the thought chain of a large reasoning model, mitigating the overthinking problem while ensuring the model's reasoning accuracy. Furthermore, since this method introduces a thought chain template for the domain corresponding to the target question during model reasoning, and this domain can be any domain, it has stronger versatility and better generalization performance.

[0042] The above embodiments briefly illustrate the construction process of the target thinking chain template. The following embodiments will describe in detail the specific construction process of the target thinking chain template.

[0043] In one embodiment, the above-mentioned target thinking chain template is constructed in the following ways: Step A1: Obtain multiple sample problems in the domain corresponding to the target problem, as well as sample problem-solving approaches for each sample problem.

[0044] It should be noted that although this embodiment describes the construction process of the target thinking chain template corresponding to the target problem, in practice, thinking chain templates for problems in any field can also be constructed in this way. Here, we only use the construction process of the target thinking chain template corresponding to the target problem as an example for explanation.

[0045] Specifically, we can first collect a dataset corresponding to the target question's domain. This dataset can include multiple sample question-and-answer pairs within the subject area of ​​the target question. Each sample question-and-answer pair includes a sample question and a sample solution approach for that sample question. The sample solution approach can be a manually input approach or a model-inferred approach, and each sample solution approach includes multiple sample solution steps. Then, we filter out sample question-and-answer pairs with non-standard formats in the dataset to obtain multiple filtered sample question-and-answer pairs. Next, we deduplicate and / or decontaminate the filtered sample question-and-answer pairs to obtain the final dataset, which includes multiple sample question-and-answer pairs. The number of multiple sample question-and-answer pairs in the final dataset is less than the number of multiple sample question-and-answer pairs in the initial dataset.

[0046] For example, taking the target problem as an example of mathematics, we can first collect datasets that are relatively new, have complete key field information, and have good crowdsourcing evaluation results from open source data websites such as Huggingface and GitHub. These include high-quality datasets such as OpenThoughts, OpenR1, and s1k, with an initial data size of 24k. Then, we filter out samples with non-standard formats, such as ASCII emoticons and invalid image references. Subsequently, we perform data deduplication and cleanup, filtering out 8-gram overlap issues in test sets such as MATH500, GPTQA, and AIME24 to reduce data redundancy, and finally obtain high-quality seed data of size 1k, which is the final dataset.

[0047] Step A2: Based on each sample problem and the corresponding sample problem-solving approach, determine the target thinking chain template for the domain corresponding to the target problem.

[0048] In this step, after obtaining multiple sample problems and multiple sample solutions, we can analyze the multiple sample problems to find common problems, and then analyze the sample solutions corresponding to these multiple sample problems to find the general solution to the common problems, which can be used as the target thinking chain template for the target problem's corresponding domain.

[0049] Alternatively, in step A2 above, based on each sample problem and the corresponding sample problem-solving approach, a target thinking chain template for the domain corresponding to the target problem is determined, including: Step A21: Based on each sample problem, determine the first sample problem-solving approach with the longest solution and the second sample problem-solving approach with the shortest solution among all sample problem-solving approaches.

[0050] This can be achieved by classifying the sample problems to obtain multiple sample problems, and then finding the longest sample problem-solving approach and the shortest sample problem-solving approach for each sample problem.

[0051] Step A22: Based on the problem-solving approaches of the first and second samples, determine the target thinking chain template for the corresponding domain of the target problem.

[0052] In this step, for each type of sample problem, the first sample solution approach and the second sample solution approach can be used to extract a general solution approach for solving common problems by combining these two sample solution approaches with the common problems of this type of sample problem. This general solution approach can then be used as a target thinking chain template for the target problem's corresponding domain.

[0053] Optionally, in step A22, based on the problem-solving approaches of the first and second samples, the target thinking chain template for the corresponding domain of the target problem is determined, including: Step A221: Based on the first problem-solving constraints in the domain corresponding to the target problem, the sample problem corresponding to the first sample problem-solving approach, and the sample problem corresponding to the second sample problem-solving approach, construct the first meta-plan template to extract prompt words; the first problem-solving constraints include constraining the word elements corresponding to the meta-plan thinking chain template extracted from each sample problem-solving approach to be within a preset number range; Step A222: Input the first-dimensional plan template extraction prompts and the first sample problem-solving approach into the second large language model. Use the first-dimensional plan template extraction prompts to guide the second large language model to extract the first-dimensional plan thinking chain template from the first sample problem-solving approach. Step A223: Input the prompt words extracted from the first-dimensional plan template and the second sample problem-solving approach into the second large language model. Use the prompt words extracted from the first-dimensional plan template to guide the second large language model to extract the second-dimensional plan thinking chain template from the second sample problem-solving approach. Step A224: Based on the first-dimensional planning mind chain template and the second-dimensional planning mind chain template, determine the target mind chain template for the domain corresponding to the target problem.

[0054] Specifically, for the target problem's corresponding domain (e.g., a sub-domain within a subject area), a first problem-solving constraint can be set for that domain. This first constraint constrains the relevant information of the output meta-planning thought chain template, such as length, format, and content constraints. Specifically, this first constraint includes: ensuring that the tokens corresponding to the meta-planning thought chain templates extracted from each sample problem-solving approach are within a preset quantity range (i.e., constraining the length of the extracted meta-planning thought chain templates); ensuring that the extracted meta-planning thought chain templates constitute general knowledge that can help solve similar problems and do not contain any information specific to a particular problem; ensuring that the format of the extracted and output meta-planning thought chain templates conforms to the format requirements of the prompt words; and ensuring that the extracted and output meta-planning thought chain templates only include the problem-solving approach and do not output any other text. Then, this first problem-solving constraint, the original prompt words, and the sample problems of this type (e.g., the sample problems corresponding to the first and second sample problem-solving approaches) can be combined to construct the first meta-planning template extraction prompt words. The original prompt words here can be prompt words that guide the large language model to extract and output meta-planning thought chain templates that can solve this type of sample problem based on the sample problem and the first solution constraint. For example, taking the target problem as a mathematics domain and the preset number of words as 1024, the prompt words for the first meta-planning template extraction constructed here can be found in [reference needed]. Figure 2 The illustration shown is a diagram of the first-dimensional programming template extraction prompt provided in this embodiment of the application. The prompt translates to: You are an expert in designing solutions for large language models. The problem to be solved is: {}; Please output your designed solution. Note that the solution should be general knowledge that can help solve similar problems, and therefore should not contain any information specific to a particular problem. Furthermore, this content will be directly added to the prompt, so please pay attention to its format. The solution should be concise and clear, with a length not exceeding 1024 tokens. Please only output the solution, and do not output any other text. It can be seen that this first-dimensional programming template extraction prompt requires the model to output an abstract and concise problem-solving solution. This solution should contain general knowledge that helps solve the corresponding type of problem, but should not include specific problem-solving information.

[0055] After constructing the first-dimensional planning template extraction prompts, both the extracted prompts and the first sample problem-solving approach can be input into the second large language model. Guided by the sample problem and problem-solving constraints in the extracted prompts, the second large language model can extract a first-dimensional planning thought chain template from the first sample problem-solving approach that contains general knowledge for solving the sample problem and meets the problem-solving constraints. This first-dimensional planning thought chain template includes multiple problem-solving steps, each of which can include one or more lexical units. Similarly, the extracted prompts and the second sample problem-solving approach can be input into the second large language model. Guided by the sample problem and problem-solving constraints in the extracted prompts, the second large language model can extract a second-dimensional planning thought chain template from the second sample problem-solving approach that contains general knowledge for solving the sample problem and meets the problem-solving constraints. This second-dimensional planning thought chain template includes multiple problem-solving steps, each of which can include one or more lexical units. Then, the common parts between the first-dimensional plan thinking chain template and the second-dimensional plan thinking chain template can be extracted as the target thinking chain template. Alternatively, the target thinking chain template can be obtained by further extracting a general thinking chain template from the first-dimensional plan thinking chain template and the second-dimensional plan thinking chain template. Or, the target thinking chain template can be obtained by taking the union of the first-dimensional plan thinking chain template and the second-dimensional plan thinking chain template and then removing duplicates.

[0056] Optionally, in obtaining the target thinking chain template by further extracting a general thinking chain template from the first-dimensional and second-dimensional planning thinking chain templates, step A224 above, which determines the target thinking chain template for the domain corresponding to the target problem based on the first-dimensional and second-dimensional planning thinking chain templates, may include: Step A2241: Based on the second problem-solving constraints, the first meta-planning mind chain template, and the second meta-planning mind chain template corresponding to the target problem, construct the second meta-planning template to extract prompt words; the second problem-solving constraints include constraining the word elements corresponding to the general meta-planning mind chain template extracted from each meta-planning mind chain template to be within a preset number range; Step A2242: Input the second meta-plan template extraction prompts, the first sample problem-solving approach, and the second sample problem-solving approach into the second large language model. Guide the second large language model to extract the general meta-plan thinking chain template from the first sample problem-solving approach and the second sample problem-solving approach through the second meta-plan template extraction prompts. Step A2243: Based on the general meta-planning mind chain template, determine the target mind chain template for the corresponding domain of the target problem.

[0057] Specifically, for the target problem's corresponding domain (e.g., a sub-domain within a subject area), a second problem-solving constraint can be set for that domain. This second constraint constrains the relevant information of the output meta-planning thought chain template, such as length and content constraints. This second constraint can be the same as or part of the first constraint. Specifically, the second constraint includes: ensuring that the lexical units corresponding to the meta-planning thought chain template extracted from each sample problem-solving approach are within a preset quantity range (i.e., constraining the length of the extracted meta-planning thought chain template); ensuring that the extracted meta-planning thought chain template is general knowledge that can help solve similar problems and must not contain any information specific to a particular problem; and ensuring that the extracted and output meta-planning thought chain template only includes the problem-solving approach and does not output any other text. Then, this second constraint, along with the original prompt words and the extracted first and second meta-planning thought chain templates, can be combined to construct the second meta-planning template extraction prompt words. The original prompt words here can be prompt words that guide the large language model to extract and output a general meta-planning thought chain template that can solve sample problems corresponding to the first and second meta-planning thought chain templates, based on the first and second meta-planning thought chain templates and the second problem-solving constraints. For example, taking a target problem in the mathematics domain with a preset number of 1024 lexical units, the prompt words for extracting the second meta-planning template can be found here. Figure 3 The diagram shown illustrates the extraction of prompts from the constructed second-dimensional plan template provided in this embodiment of the application. The prompts translate as: Given a mathematical domain and a reasoning template for an example problem, generate a general meta-solution capable of solving problems within that domain. Please output your designed solution. Note that the solution should be general knowledge that helps solve similar problems and therefore should not contain any information specific to a particular problem. The solution should be concise and clear, with a length not exceeding 1024 tokens. Please output only the solution, without any other text. Mathematical Domain: {}; Reasoning Template 1: {}; Reasoning Template 2: {}; Output Plan. Reasoning Template 1 and Reasoning Template 2 are respectively filled with the first-dimensional plan thought chain template and the second-dimensional plan thought chain template.

[0058] After constructing the second-dimensional planning template extraction prompts, these prompts, the solution strategies for the first and second samples, can all be input into the second large language model. Guided by the first and second-dimensional planning thought chain templates and problem-solving constraints within the second-dimensional planning template extraction prompts, the second large language model can extract a general meta-planning thought chain template from the first and second sample problem-solving strategies. This general meta-planning thought chain template contains multiple problem-solving steps, each of which can include one or more lexical units. This general meta-planning thought chain template can then be used as the target thought chain template.

[0059] The general meta-planning thought chain templates generated based on the shortest and longest sample problem-solving approaches possess a certain degree of universality in both form and content. The general meta-planning thought chain templates for various sample problems within a specific subject area are organized in a list-point format, with the number of solution steps ranging from 8 to 12. Each step typically includes a concise step name and a one-sentence explanation. In terms of content, these general meta-planning thought chain templates generally include reasoning steps such as problem understanding, symbol definition, theorem selection, expression simplification, and correctness verification, conforming to the general problem-solving logic of mathematics. For example, taking a target problem in the field of mathematics, including number theory problems, the generated general meta-planning thought chain templates for solving number theory problems can be found in [reference needed]. Figure 4 The diagram shown is a schematic of the generated general meta-planning mind chain template provided in the embodiment of this application. The general meta-planning mind chain template is translated as follows: The meta-solution for solving number theory problems: 1. Understand the problem structure: Identify key attributes (e.g., divisibility, modular arithmetic, prime factorization) and constraints (e.g., range, uniqueness, existence).

[0060] 2. Mathematical modeling of the problem: Use number theory tools (such as congruence, divisor, greatest common divisor (GCD), least common multiple (LCM) or graphical representation) to transform the conditions into equations or relations.

[0061] 3. Analyze Periodicity and Patterns: Where applicable, study the behavior of recursive or iterative functions on integer modulo. Determine if periodicity exists and under what conditions it can be avoided (e.g., by analyzing powers in modular arithmetic).

[0062] 4. Enumerate and filter candidate values: For questions involving guessing or elimination, list all possible values ​​that satisfy the initial constraints. Iteratively eliminate invalid candidate values ​​using logical reasoning based on the speaker's statement or question-specific rules.

[0063] 5. Apply modular arithmetic: Use the properties of remainders and equivalence classes to simplify expressions, identify periodicity, or simplify complex conditions.

[0064] 6. Use divisibility rules and prime factorization: When considering factors, multiples, or coprime relationships, decompose numbers into their prime factors. Apply known theorems (e.g., the Chinese Remainder Theorem, Fermat's Little Theorem).

[0065] 7. Test small-scale cases: For general problems, test small values ​​of variables or parameters to discover patterns or counterexamples, thereby guiding the derivation of general solutions.

[0066] 8. Summarize observations: From specific examples or tests, deduce conjectures about efficient solutions or structures. Use mathematical induction, proof by contradiction, or direct proof techniques to prove these conjectures.

[0067] 9. Ensure logical consistency: Verify that the final solution satisfies all given conditions and does not depend on contradictory assumptions.

[0068] 10. Conclude with a clear description of features: Present the solution with necessary and sufficient conditions, usually expressed in modular form, prime factorization, or structural properties (e.g., powers of 2).

[0069] Among them, understanding the problem structure and mathematically modeling the problem are the step names of the reasoning steps in the general meta-plan thinking chain template, followed by a one-sentence explanation of the step name.

[0070] In addition, the second major language model mentioned above can be of the same type as the first major language model, such as the QwQ-32B open-source major language model, whose output is relatively concise.

[0071] In this embodiment, multiple sample questions and their solutions within the target problem domain are collected to construct a thought chain template for that domain. This ensures a controllable length range for the constructed thought chain template, preventing overthinking during subsequent model inference. Furthermore, this more domain-specific thought chain template leads to more accurate answers generated based on it. Additionally, by identifying the longest and shortest sample solutions and their corresponding questions, a thought chain template for the target problem domain is constructed. This ensures the final thought chain template covers the thought process for problems within that domain. Finally, by constructing meta-planning extraction prompts, the prompts, along with the longest / shortest sample solutions and their corresponding questions, are input into a large language model. The large language model extracts the corresponding meta-planning thought chain templates, which are then used to obtain the thought chain template for the target problem domain. This allows for the rapid and accurate acquisition of the thought chain template for the target problem domain. Furthermore, by constructing meta-plan extraction prompts through the longest / shortest meta-plan thinking chain, the meta-plan extraction prompts and the longest / shortest sample problem-solving ideas are input into the large language model. The large language model extracts a general meta-plan thinking chain template, and then obtains the thinking chain template corresponding to the target problem domain. This ensures that the final extracted target thinking chain template can not only solve the problem in the domain, but also cover the thinking process of the problem in the domain.

[0072] The above embodiments mention that the problem can be classified into categories and then the longest and shortest solution ideas can be extracted from each category. The following embodiments will describe this process in detail.

[0073] In one embodiment, step A21 above, based on each sample problem, determines the first sample problem-solving approach with the longest solution and the second sample problem-solving approach with the shortest solution, including: Step A211: Classify each sample problem and determine the subdomain category corresponding to each sample problem; each subdomain category belongs to the subdomain category under the domain corresponding to the target problem.

[0074] Each subject area can have multiple sub-fields with finer granularity. After obtaining the sample questions corresponding to the target question, these sample questions can be questions for multiple sub-fields under a subject area. Here, we can first classify each sample question into sub-fields according to the multiple sub-field categories corresponding to the subject area to obtain the sub-field category to which each sample question belongs.

[0075] Optionally, the classification of each sample question in step A211 to determine the sub-domain category corresponding to each sample question may include: Based on the classification system of the target problem's corresponding domain, determine the multiple sub-domain categories corresponding to the target problem's corresponding domain; Construct category suggestions based on each sub-domain category; Based on the sample questions, classification prompts, and the third language model, the sample questions are classified to determine the sub-domain category corresponding to each sample question.

[0076] Specifically, after identifying the subject area corresponding to the target problem, one can first obtain the classification system for that subject area. This classification system refers to the method of classifying the sub-fields under that subject area, such as the Mathematics Subject Classification (MSC) for the data field. Through this classification system, multiple sub-field categories can be obtained within that subject area. Then, each sub-field category is mapped to a code, that is, each sub-field category is encoded to obtain a corresponding code symbol / code. The code symbols for each sub-field category are different. For example, according to the classification system for the mathematics field, the mathematics field can be divided into eight sub-field categories: Calculus, Algebra, Precalculus, Applied Mathematics, Geometry, Discrete Mathematics, Number Theory, and Differential Equations. The code symbols for each sub-field category can be 01, 02, ..., 08.

[0077] Then, based on the coding symbols, sub-domain category names, and sub-domain category explanations of each sub-domain within the domain corresponding to the target question, a subject list is generated. Simultaneously, sample questions (initially empty) and relevant prompts guiding the large language model to classify the sample questions based on this subject list are added to this subject list, thus forming the final classification prompts. For an example, see [link to example]. Figure 5 The diagram shown below illustrates the constructed category suggestion words provided in this application embodiment, wherein the category suggestion words are translated as follows: You are a helpful assistant who can categorize questions into different subjects based on provided classification rules. You will receive a question and a list of subjects. You need to categorize the question into one of the subjects. If the question involves multiple subjects, you should categorize it into the most relevant one. Please explain your reasoning process and include the two-digit code of the relevant subject on a separate line at the end of your reply.

[0078] question{}; Classification rules Calculus Code: 01 Description: Differential calculus; Integral calculus; Algebraic Code: 02 Description: Pre-algebra; Intermediate algebra; Linear algebra; Abstract algebra; Precalculus code: 03 Description: Function; Limit; Trigonometric functions; Applied Mathematics Code: 04 Description: Mathematical word problem; Statistics; Geometry Code: 05 Description: Plane geometry; Solid geometry; Differential geometry; Non-Euclidean geometry; Discrete Mathematics Code: 06 Description: Graph Theory; Combinatorial Mathematics; Logic; Algorithms Number Theory Code: 07 Description: Prime numbers; factorization; congruence; greatest common divisor (GCD); least common multiple (LCM); Differential equation code: 08 Description: Ordinary differential equations (ODEs); Partial differential equations (PDEs).

[0079] After constructing the classification prompts, the prompts and sample questions can be input into the third language model. The third language model will then populate each sample question with the corresponding field from the classification prompts, classify the sample question according to the subject list in the prompts, and obtain the corresponding encoding symbol. This encoding symbol reflects the sub-domain category to which the sample question belongs. Outputting the encoding symbol for the sample question facilitates accurate parsing of the classification results.

[0080] In addition, the third major language model mentioned above can be different from the first and second major language models. For example, it could be the Qwen-72b Tongyi Qianwen series of language models, which can accurately classify each sample question with fine granularity.

[0081] Step A212: According to the subdomain category corresponding to each sample problem, group the sample problems belonging to the same subdomain category and their corresponding sample problem-solving approaches together to obtain the data set corresponding to each subdomain category.

[0082] After obtaining the subdomain category corresponding to each sample problem, multiple sample problems belonging to the same subdomain category can be found. These multiple sample problems belonging to the same subdomain category and their corresponding sample solutions are then grouped into a dataset, resulting in the dataset corresponding to each subdomain category. Simultaneously, the proportion of sample problems in each dataset to the total number of sample problems can be statistically analyzed to obtain the proportion of each dataset and generate a distribution chart of the proportion of subdomain categories for subsequent analysis.

[0083] For example, taking the target problem as the field of mathematics, which includes eight subfields, the sample problems mentioned above are sample problems within the field of mathematics. After classifying and statistically analyzing the proportion of each sample problem, the resulting distribution chart of the proportion of subfield categories can be found in [reference needed]. Figure 6 The diagram showing the distribution of the number of sub-domain categories provided in the embodiments of this application shows that the differences in the number of most sub-domain categories are not significant, that is, they are relatively uniform.

[0084] Step A213: For each sub-domain category, determine the first sample problem-solving approach with the longest solution and the second sample problem-solving approach with the shortest solution in the data set.

[0085] Among these, the length of the solution approach output by the large language model after answer reasoning varies significantly for questions of different difficulties. For example, difficult questions usually require more solution steps, and the large language model's thinking process is often longer, resulting in a longer output solution approach. Conversely, simple questions do not require much reasoning, and the large language model's output is usually shorter, meaning the output solution approach is often shorter. To enhance the difficulty coverage of each type of sample question and the diversity of solution approaches, this embodiment, after obtaining the dataset for each subdomain category, statistically analyzes the lengths of multiple sample solution approaches in each subdomain dataset, identifying the longest first sample solution approach and the shortest second sample solution approach. These first and second sample solution approaches are then used as representatives for subsequent extraction of a general meta-planning mind chain template for that subdomain.

[0086] For example, continuing with the mathematical domain corresponding to the target problem, which includes 8 sub-domains, we find the longest first sample solution and the shortest second sample solution in each sub-domain. We then sample / obtain the shortest and longest sample solutions from the model output as representatives for thought template extraction, ultimately obtaining 16 sample data points. The length distribution of the longest first sample solution and the shortest second sample solution in each sub-domain's dataset (i.e., the model's output length distribution) is shown in Table 1 below. Table 1 Shortest length longest length Algebra 33829 50163 geometry 52579 56056 Discrete Mathematics 47568 57831 Number Theory 42904 46847 Applied Mathematics 4975 45749 Calculus 31090 40265 Precalculus 16269 33955 Differential equations 7422 25285 After obtaining the first and second sample problem-solving approaches corresponding to the datasets of each subdomain, a general meta-planning mind chain template can be extracted for each subdomain. Optionally, in step A22 above, the target mind chain template for the domain corresponding to the target problem is determined based on the first and second sample problem-solving approaches, including: For each sub-domain category, based on the problem-solving approaches of the first and second samples in the dataset, determine the general meta-planning mind chain template for the sub-domain category. Based on the general meta-planning mind chain template corresponding to each sub-domain category, determine the target mind chain template for the domain corresponding to the target problem.

[0087] Specifically, for each subdomain category's corresponding dataset, based on the first and second sample problem-solving approaches corresponding to that dataset, following steps A221-A223 above, the second major language model is used to extract the first meta-planning thought chain template corresponding to the first sample problem-solving approach and the second meta-planning thought chain template corresponding to the second sample problem-solving approach. Then, following steps A2241-A2242 above, the general meta-planning thought chain template corresponding to that dataset is obtained. This method yields the general meta-planning thought chain template for each subdomain's dataset. Finally, the general meta-planning thought chain templates for all subdomain datasets are combined to form the target thought chain template for the target problem's corresponding domain.

[0088] In this embodiment, by classifying each sample problem into sub-domains, and then selecting the longest and shortest problem-solving approaches for each sub-domain's dataset, the extraction of the longest and shortest problem-solving approaches from sub-domains within a larger domain for subsequent extraction of general meta-planning thought chain templates can improve the difficulty coverage and problem-solving approach diversity within that domain. Furthermore, by first determining multiple sub-domain categories through a specific domain's classification system, and then constructing classification prompts based on these categories to classify each sample problem, accurate and rapid classification of each sample problem is achieved. Further, by determining and combining general meta-planning thought chain templates for each sub-domain, the thought chain template corresponding to the target problem's domain is obtained, resulting in a more diverse and comprehensive set of thought chain templates for the target problem's domain.

[0089] The following provides an overall embodiment to illustrate the technical solution of this application. See also: Figure 7The diagram shown in this application illustrates the overall process of the question-answering method based on thought chain provided in this embodiment. It mainly includes five modules: data preprocessing, diversity classification, longest and shortest sample sampling, meta-plan template extraction, and large-scale inference model inference. The aim is to shorten the thought chain template while keeping the model performance unaffected, thereby improving the utilization rate of model tokens. Taking mathematics as an example, this method includes: First, collecting a batch of high-quality mathematical problem data, including data source 1, data source 2, data source 3, ...; then, subdividing the problem data into subcategories such as calculus (type 1), algebra (type 2), pre-calculus (type 3), applied mathematics (type 4), geometry (type 5), discrete mathematics (type 6), number theory (type 7), and differential equations (type 8) to ensure diversity for subsequent sample sampling; for each type of mathematical problem, sampling / obtaining the shortest and longest sample problem-solving approaches output by the large language model for subsequent meta-planning thought chain template extraction, thereby enhancing the difficulty coverage of representative problems and the diversity of problem-solving approaches; then, for each selected sample problem and sample problem-solving approach, generating an abstract and concise thought template based on the large language model. This thought template is a high-level summary and refinement of the problem-solving process, omitting specific calculation details and retaining the most core problem-solving approach. Building upon this foundation, we further extract general meta-planning thought chain templates for various types of problems. These templates are organized in a point-by-point format, with the number of steps in each step ranging from ten (e.g., 8 to 12). Each step typically includes a concise name and a one-sentence explanation, covering reasoning steps such as problem understanding, symbol definition, theorem selection, expression simplification, and correctness verification, conforming to the general problem-solving logic of mathematics. Finally, we add these general meta-planning thought chain templates to the system prompts to pre-plan the reasoning path for solving problems. This allows for precise guidance and effective compression of the reasoning process in large-scale reasoning models, which helps improve the accuracy of model reasoning, reduces computational resource consumption, and shortens reasoning time.

[0090] For example, taking the target problem's corresponding domain as the mathematics domain, which includes eight sub-domains, the system prompts for the final universal meta-plan mind chain template incorporated into the mathematics domain can be found in [link to relevant documentation]. Figure 8 As shown, only the general meta-planning thought chain template for the number theory subdomain is displayed. General meta-planning thought chain templates for other subdomains can be added sequentially after the general meta-planning thought chain template for the number theory subdomain. The system prompt is translated as: You are an expert in the field of mathematics and are skilled at effectively solving various mathematical problems.

[0091] Please refer to the following reasoning template to efficiently answer user questions: Number Theory: 1. Identify the core number theory properties or constraints in the problem (e.g., divisibility, congruence, prime properties, or number-based conditions).

[0092] 2. Transform the problem into an algebraic expression or a modular expression to formalize the relationship between variables.

[0093] 3. Study small-scale cases or special values ​​to discover patterns, exceptions, or make conjectures.

[0094] 4. Where applicable, apply known number theory theorems or lemmas (e.g., Euclidean algorithm, Chinese Remainder Theorem, Fermat's Little Theorem).

[0095] 5. Use logical reasoning and situation analysis to narrow down the range of possibilities or construct counterexamples.

[0096] 6. When dealing with problems involving multiple subjects or multiple rounds of information, model their knowledge state and update these states iteratively based on each statement.

[0097] 7. Summarize from specific observations and derive feature descriptions or formulas for all valid inputs.

[0098] 8. Verify consistency across different scenarios and ensure that no contradictions arise within the constraints.

[0099] Algebra: ...

[0100] As can be seen, the embodiments of this application are intended for a wider range of reasoning tasks. The general meta-plan extraction process can be extended to data in any domain without additional fine-tuning training. Therefore, it can more efficiently compress and optimize the thought chain of large reasoning models, alleviate the problem of overthinking in the reasoning stage of the model while ensuring accuracy, and help improve the reasoning performance of large models. It has high application value.

[0101] Ultimately, the model using system prompts guided by the MetaProject mind chain template achieved a reduction in average token length. For example, QwQ-32 saw an average token length reduction of 14.16% on the MATH500 test set and 4.67% on s1k. Simultaneously, the model's accuracy remained consistent with that using the default system prompts, validating the effectiveness of this application's technical solution in mind chain optimization.

[0102] The question-answering device based on thought chain provided in the embodiments of this application will be described below. The question-answering device based on thought chain described below can be referred to in correspondence with the question-answering method based on thought chain described above.

[0103] Figure 9This is a schematic diagram of the structure of the question-answering device based on the thought chain provided in the embodiments of this application. See also: Figure 9 As shown, the device may include: Problem Acquisition Module 910 is used to acquire target problems; The thought chain prompt word determination module 920 is used to determine target prompt words for the target question based on the target question; the target prompt words include target thought chain templates for the corresponding domain of the target question, and the number of word elements corresponding to the target thought chain templates is within a preset range; The answer module 930 is used to input the target question and target prompt words into the first language model. The target thinking chain template in the target prompt words guides the first language model to reason about the answer to the target question and determine the target problem-solving approach corresponding to the target question. The number of lexical units corresponding to the above target problem-solving approach is within a preset range.

[0104] In one embodiment, the aforementioned thought chain prompt word determination module 920 is specifically used to determine the target domain corresponding to the target question based on the target question; determine the target thought chain template corresponding to the target domain in a first correspondence relationship based on the target domain; the aforementioned first correspondence relationship includes at least one domain and a thought chain template corresponding to each domain; and determine the target prompt word for the target question based on the target thought chain template.

[0105] In one embodiment, the above apparatus further includes: a thinking chain template construction module, which is used to obtain multiple sample questions in the domain corresponding to the target problem and sample problem-solving ideas corresponding to each sample question; and to determine the target thinking chain template in the domain corresponding to the target problem based on each sample question and the sample problem-solving ideas corresponding to each sample question.

[0106] Optionally, the aforementioned thought chain template construction module is specifically used to determine, based on each sample problem, the first sample problem-solving approach with the longest solution and the second sample problem-solving approach with the shortest solution; and based on the first and second sample problem-solving approaches, to determine the target thought chain template for the corresponding domain of the target problem.

[0107] Optionally, the aforementioned thought chain template construction module is specifically used to construct first meta-plan template extraction prompts based on the first problem-solving constraints in the domain corresponding to the target problem, the sample problems corresponding to the first sample problem-solving approaches, and the sample problems corresponding to the second sample problem-solving approaches. The first problem-solving constraints include ensuring that the lexical units corresponding to the meta-plan thought chain templates extracted from each sample problem-solving approach are within a preset number. The first meta-plan template extraction prompts and the first sample problem-solving approaches are input into the second large language model, guiding the second large language model to extract the first meta-plan thought chain template from the first sample problem-solving approaches. The first meta-plan template extraction prompts and the second sample problem-solving approaches are input into the second large language model, guiding the second large language model to extract the second meta-plan thought chain template from the second sample problem-solving approaches. Based on the first meta-plan thought chain template and the second meta-plan thought chain template, the target thought chain template for the domain corresponding to the target problem is determined.

[0108] Optionally, the aforementioned thought chain template construction module is specifically used to construct second meta-plan template extraction prompts based on the second problem-solving constraints, the first meta-plan thought chain template, and the second meta-plan thought chain template corresponding to the target problem's domain; the second problem-solving constraints include constraining the word units corresponding to the general meta-plan thought chain template extracted from each meta-plan thought chain template to be within a preset number range; inputting the second meta-plan template extraction prompts, the first sample problem-solving approach, and the second sample problem-solving approach into the second large language model, guiding the second large language model to extract the general meta-plan thought chain template from the first and second sample problem-solving approaches through the second meta-plan template extraction prompts; and determining the target thought chain template corresponding to the target problem's domain based on the general meta-plan thought chain template.

[0109] Optionally, the aforementioned thought chain template construction module is specifically used to classify each sample problem and determine the sub-domain category corresponding to each sample problem; each sub-domain category belongs to the sub-domain category under the domain corresponding to the target problem; according to the sub-domain category corresponding to each sample problem, each sample problem belonging to the same sub-domain category and its corresponding sample solution ideas are grouped together to obtain the data set corresponding to each sub-domain category; for the data set corresponding to each sub-domain category, the first sample solution idea with the longest sample solution idea and the second sample solution idea with the shortest sample solution idea are determined in the data set.

[0110] Optionally, the aforementioned thought chain template construction module is specifically used to determine multiple sub-domain categories corresponding to the target problem based on the classification system of the target problem's corresponding domain; construct classification prompts based on each sub-domain category; and classify each sample problem based on each sample problem, the classification prompts, and the third major language model to determine the sub-domain category corresponding to each sample problem.

[0111] Optionally, the aforementioned thinking chain template construction module is specifically used to determine the general meta-plan thinking chain template corresponding to the sub-domain category based on the problem-solving ideas of the first and second samples in the data set corresponding to each sub-domain category; and to determine the target thinking chain template corresponding to the target problem in the domain based on the general meta-plan thinking chain template corresponding to each sub-domain category.

[0112] The devices involved in the embodiments of this application can be terminals or servers. If a terminal, it can be a device that provides voice and / or data connectivity to a user, a handheld device with wireless connectivity, or other processing devices connected to a wireless modem, etc. If a server, it can be a standalone server or a server cluster.

[0113] Figure 10 This is a schematic diagram of the device according to an embodiment of this application, with reference to... Figure 10 This application also provides a device that may include: a memory 1010, a transceiver 1020, and a processor 1030; The memory 1010 is used to store computer programs; the transceiver 1020 is used to send and receive data under the control of the processor 1030; the processor 1030 is used to read the computer program in the memory 1010 and perform the following operations: Identify the target problem; Based on the target question, target prompts are determined for the target question; the target prompts include target thinking chain templates for the corresponding domain of the target question, and the number of word elements corresponding to the target thinking chain templates is within a preset range; The target question and target prompt words are input into the first language model. The target thinking chain template in the target prompt words guides the first language model to reason about the answer to the target question and determine the target problem-solving approach corresponding to the target question. The number of lexical units corresponding to the above target problem-solving approach is within the preset range.

[0114] Among them, Figure 10In this context, the bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits together, such as one or more processors represented by processor 1030 and memory represented by memory 1010. The bus architecture can also link together various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 1020 can be multiple elements, including transmitters and receivers, providing a unit for communicating with various other devices over a transmission medium. For different user equipment, the user interface 1040 can also be an interface capable of connecting external or internal devices as needed.

[0115] The processor 1030 is responsible for managing the bus architecture and general processing, while the memory 1010 can store the data used by the processor 1030 when performing operations.

[0116] The processor 1030 executes any of the methods described in the embodiments of this application by calling a computer program stored in the memory 1010, according to the obtained executable instructions. The processor and the memory may also be physically separated.

[0117] Optionally, the processor 1030 is also used to perform the following operations: Based on the target problem, determine the target domain corresponding to the target problem; Based on the target domain, a target thinking chain template corresponding to the target domain is determined in the first correspondence relationship; the first correspondence relationship includes at least one domain and a thinking chain template corresponding to each domain. Based on the target mind chain template, identify target prompts for the target problem.

[0118] Optionally, the processor 1030 is also used to perform the following operations: Obtain multiple sample problems in the domain corresponding to the target problem, as well as sample problem-solving approaches for each sample problem; Based on each sample problem and the corresponding sample problem-solving approach, determine the target thinking chain template for the domain corresponding to the target problem.

[0119] Optionally, the processor 1030 is also used to perform the following operations: Based on each sample problem, determine the first sample problem-solving approach with the longest solution and the second sample problem-solving approach with the shortest solution among all sample problem-solving approaches; Based on the problem-solving approaches of the first and second samples, determine the target thinking chain template for the corresponding domain of the target problem.

[0120] Optionally, the processor 1030 is also used to perform the following operations: Based on the first problem-solving constraints in the domain corresponding to the target problem, the sample problems corresponding to the first sample problem-solving approaches, and the sample problems corresponding to the second sample problem-solving approaches, a first meta-plan template is constructed to extract prompt words; the first problem-solving constraints include the constraint that the word elements corresponding to the meta-plan thinking chain templates extracted from each sample problem-solving approach are within a preset number range; The prompt words extracted from the first-dimensional plan template and the problem-solving ideas from the first sample are input into the second large language model. The prompt words extracted from the first-dimensional plan template guide the second large language model to extract the first-dimensional plan thinking chain template from the problem-solving ideas from the first sample. The prompt words extracted from the first-dimensional plan template and the problem-solving ideas from the second sample are input into the second large language model. The prompt words extracted from the first-dimensional plan template guide the second large language model to extract the second-dimensional plan thinking chain template from the problem-solving ideas from the second sample. Based on the first and second elemental plan thinking chain templates, determine the target thinking chain template for the corresponding domain of the target problem.

[0121] Optionally, the processor 1030 is also used to perform the following operations: Based on the second problem-solving constraints, the first meta-planning thought chain template, and the second meta-planning thought chain template corresponding to the target problem, construct the second meta-planning template to extract prompt words; the above-mentioned second problem-solving constraints include constraining the word elements corresponding to the general meta-planning thought chain template extracted from each meta-planning thought chain template to be within a preset number range; The second meta-plan template extraction prompts, the first sample problem-solving approach, and the second sample problem-solving approach are input into the second large language model. The second meta-plan template extraction prompts guide the second large language model to extract the general meta-plan thinking chain template from the first sample problem-solving approach and the second sample problem-solving approach. Based on the general meta-plan thinking chain template, determine the target thinking chain template for the corresponding domain of the target problem.

[0122] Optionally, the processor 1030 is also used to perform the following operations: Each sample problem is classified to determine the corresponding subdomain category; each subdomain category belongs to the subdomain category under the domain corresponding to the target problem. Based on the subdomain category corresponding to each sample problem, group the sample problems belonging to the same subdomain category and their corresponding sample problem-solving approaches together to obtain the dataset corresponding to each subdomain category; For each subdomain category, determine the first sample solution with the longest solution and the second sample solution with the shortest solution in the dataset.

[0123] Optionally, the processor 1030 is also used to perform the following operations: Based on the classification system of the target problem's corresponding domain, determine the multiple sub-domain categories corresponding to the target problem's corresponding domain; Construct category suggestions based on each sub-domain category; Based on the sample questions, classification prompts, and the third language model, the sample questions are classified to determine the sub-domain category corresponding to each sample question.

[0124] Optionally, the processor 1030 is also used to perform the following operations: For each sub-domain category, based on the problem-solving approaches of the first and second samples in the dataset, determine the general meta-planning mind chain template for the sub-domain category. Based on the general meta-planning mind chain template corresponding to each sub-domain category, determine the target mind chain template for the domain corresponding to the target problem.

[0125] It should be noted that the device provided in this application embodiment can implement all the method steps implemented in the above method embodiment and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.

[0126] Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 11 As shown, the electronic device may include: a processor 1110, a communication interface 1120, a memory 1130, and a communication bus 1140, wherein the processor 1110, the communication interface 1120, and the memory 1130 communicate with each other via the communication bus 1140. The processor 1110 can call a computer program in the memory 1130 to execute steps of a thought-chain-based question-and-answer method, such as: Obtain the target question; based on the target question, determine the target prompt words for the target question; the target prompt words include the target thinking chain template corresponding to the target question, and the number of word units corresponding to the target thinking chain template is within a preset range; input the target question and target prompt words into the first language model, and guide the first language model to reason about the answer to the target question through the target thinking chain template in the target prompt words, and determine the target problem-solving approach corresponding to the target question; the number of word units corresponding to the target problem-solving approach is within a preset range.

[0127] Furthermore, the logical instructions in the aforementioned memory 1130 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0128] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the steps of the thought chain-based question-answering method provided in the above embodiments, such as including: Obtain the target question; based on the target question, determine the target prompt words for the target question; the target prompt words include the target thinking chain template corresponding to the target question, and the number of word units corresponding to the target thinking chain template is within a preset range; input the target question and target prompt words into the first language model, and guide the first language model to reason about the answer to the target question through the target thinking chain template in the target prompt words, and determine the target problem-solving approach corresponding to the target question; the number of word units corresponding to the target problem-solving approach is within a preset range.

[0129] On the other hand, embodiments of this application also provide a processor-readable storage medium storing a computer program for causing a processor to perform the steps of the methods provided in the above embodiments, such as including: Obtain the target question; based on the target question, determine the target prompt words for the target question; the target prompt words include the target thinking chain template corresponding to the target question, and the number of word units corresponding to the target thinking chain template is within a preset range; input the target question and target prompt words into the first language model, and guide the first language model to reason about the answer to the target question through the target thinking chain template in the target prompt words, and determine the target problem-solving approach corresponding to the target question; the number of word units corresponding to the target problem-solving approach is within a preset range.

[0130] The processor-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to magnetic memory (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical memory (e.g., CD, DVD, BD, HVD), and semiconductor memory (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).

[0131] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0132] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method of question answering based on a chain of thoughts, characterized by, include: Identify the target problem; Based on the target question, determine the target prompt words for the target question; The target prompt includes a target thinking chain template for the domain corresponding to the target question, and the number of word elements corresponding to the target thinking chain template is within a preset range. The target question and the target prompt words are input into the first large language model. The target thinking chain template in the target prompt words guides the first large language model to reason about the answer to the target question and determine the target problem-solving approach corresponding to the target question. The number of lexical units corresponding to the target problem-solving approach is within the preset range.

2. The question-and-answer method based on thought chain according to claim 1, characterized in that, The step of determining target prompts for the target question based on the target question includes: Based on the target problem, determine the target domain corresponding to the target problem; Based on the target domain, a target thinking chain template corresponding to the target domain is determined in a first correspondence relationship; the first correspondence relationship includes at least one domain and a thinking chain template corresponding to each domain; Based on the target thought chain template, target prompts are determined for the target question.

3. The question-and-answer method based on thought chain according to claim 1, characterized in that, The construction methods of the target thinking chain template include: Obtain multiple sample problems in the domain corresponding to the target problem, as well as sample problem-solving approaches for each sample problem; Based on each sample problem and the corresponding sample problem-solving approach, determine the target thinking chain template for the domain corresponding to the target problem.

4. The question-and-answer method based on thought chain according to claim 3, characterized in that, The step of determining the target thinking chain template for the corresponding domain of the target problem based on each of the sample problems and the corresponding sample problem-solving approaches includes: Based on each of the sample problems, determine the first sample problem-solving approach with the longest solution and the second sample problem-solving approach with the shortest solution among the sample problem-solving approaches; Based on the problem-solving approaches of the first and second samples, a target thinking chain template for the domain corresponding to the target problem is determined.

5. The question-and-answer method based on thought chain according to claim 4, characterized in that, The step of determining the target thinking chain template for the domain corresponding to the target problem based on the problem-solving approaches of the first and second samples includes: Based on the first problem-solving constraints in the domain corresponding to the target problem, the sample problem corresponding to the first sample problem-solving approach, and the sample problem corresponding to the second sample problem-solving approach, a first meta-planning template is constructed to extract prompt words; the first problem-solving constraints include restricting the word elements corresponding to the meta-planning thought chain template extracted from each sample problem-solving approach to be within the preset number range; The prompt words extracted from the first meta-plan template and the problem-solving approach of the first sample are input into the second large language model. The prompt words extracted from the first meta-plan template guide the second large language model to extract the first meta-plan thinking chain template from the problem-solving approach of the first sample. The prompt words extracted from the first meta-plan template and the problem-solving ideas from the second sample are input into the second large language model. The prompt words extracted from the first meta-plan template guide the second large language model to extract the second meta-plan thinking chain template from the problem-solving ideas from the second sample. Based on the first meta-planning mind chain template and the second meta-planning mind chain template, determine the target mind chain template for the domain corresponding to the target problem.

6. The question-and-answer method based on thought chain according to claim 5, characterized in that, The step of determining the target thinking chain template for the domain corresponding to the target problem based on the first meta-planning thinking chain template and the second meta-planning thinking chain template includes: Based on the second problem-solving constraints in the domain corresponding to the target problem, the first meta-planning mind chain template, and the second meta-planning mind chain template, a second meta-planning template is constructed to extract prompt words; the second problem-solving constraints include constraining the word elements corresponding to the general meta-planning mind chain template extracted from each meta-planning mind chain template to be within the preset number range; The second meta-planning template extraction prompt, the first sample problem-solving approach, and the second sample problem-solving approach are input into the second large language model. The second meta-planning template extraction prompt guides the second large language model to extract the general meta-planning mind chain template from the first sample problem-solving approach and the second sample problem-solving approach. Based on the general meta-planning mind chain template, determine the target mind chain template for the domain corresponding to the target problem.

7. The question-answering method based on thought chain according to any one of claims 4 to 6, characterized in that, The step of determining the longest first sample solution and the shortest second sample solution among the sample solutions for each sample problem includes: Each of the sample problems is classified to determine the sub-domain category corresponding to each sample problem; each of the sub-domain categories belongs to the sub-domain category under the domain corresponding to the target problem. According to the subdomain category corresponding to each of the sample problems, group the sample problems belonging to the same subdomain category and their corresponding sample problem-solving approaches together to obtain the data set corresponding to each subdomain category; For each sub-domain category, determine the first sample problem-solving approach with the longest solution and the second sample problem-solving approach with the shortest solution in the data set.

8. The question-answering method based on thought chain according to claim 7, characterized in that, The process of classifying each of the sample problems to determine the sub-domain category corresponding to each sample problem includes: Based on the classification system of the domain corresponding to the target problem, determine multiple sub-domain categories corresponding to the domain corresponding to the target problem; Construct category suggestions based on each of the sub-domain categories; Based on the sample questions, the classification prompts, and the third language model, the sample questions are classified to determine the sub-domain category corresponding to each sample question.

9. The question-answering method based on thought chain according to claim 7, characterized in that, The step of determining the target thinking chain template for the domain corresponding to the target problem based on the problem-solving approaches of the first and second samples includes: For each data set corresponding to a sub-domain category, a general meta-planning mind chain template corresponding to the sub-domain category is determined based on the problem-solving approaches of the first and second samples in the data set. Based on the general meta-planning mind chain template corresponding to each of the sub-domain categories, determine the target mind chain template for the domain corresponding to the target problem.

10. A question-and-answer device based on thought chain, characterized in that, include: The problem retrieval module is used to retrieve the target problem; The thought chain prompt word determination module is used to determine target prompt words for the target question based on the target question. The target prompt includes a target thinking chain template for the domain corresponding to the target question, and the number of word elements corresponding to the target thinking chain template is within a preset range. The answering module is used to input the target question and the target prompt words into the first large language model, and guide the first large language model to reason about the answer to the target question through the target thought chain template in the target prompt words, and determine the target problem-solving approach corresponding to the target question. The number of lexical units corresponding to the target problem-solving approach is within the preset range.

11. A device, characterized in that, Includes memory, transceiver, and processor; A memory for storing computer programs; a transceiver for sending and receiving data under the control of the processor; and a processor for reading the computer programs from the memory and performing the following operations: Identify the target problem; Based on the target question, determine the target prompt words for the target question; The target prompt includes a target thinking chain template for the domain corresponding to the target question, and the number of word elements corresponding to the target thinking chain template is within a preset range. The target question and the target prompt words are input into the first large language model. The target thinking chain template in the target prompt words guides the first large language model to reason about the answer to the target question and determine the target problem-solving approach corresponding to the target question. The number of lexical units corresponding to the target problem-solving approach is within the preset range.

12. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the question-and-answer method based on thought chain as described in any one of claims 1 to 9.

13. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the question-answering method based on thought chain as described in any one of claims 1 to 9.

14. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the question-answering method based on the thought chain as described in any one of claims 1 to 9.