Method and device for executing reasoning task

By constructing multiple prompts, the language model is instructed to use multiple languages ​​and tools to generate multiple candidate reasoning paths and results, which solves the problem of insufficient performance of language models in complex reasoning tasks and achieves more accurate and efficient reasoning results.

CN121766424APending Publication Date: 2026-03-31HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411393041.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing language models have insufficient reasoning performance in complex reasoning tasks and cannot meet the needs of practical applications.

Method used

By constructing multiple prompts, the language model is instructed to use multiple languages ​​and/or call multiple tools to generate multiple candidate inference paths and results. The target inference result is determined based on the candidate results. By leveraging the multilingual capabilities and tool calling capabilities of the large language model, the diversity and accuracy of inference paths are improved.

Benefits of technology

It improves the performance of language models in complex reasoning tasks, generates diverse candidate reasoning paths, avoids local optima, and improves the accuracy and efficiency of reasoning results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121766424A_ABST
    Figure CN121766424A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for executing an inference task. The method comprises the steps that a to-be-solved inference problem is received; constructing one or more prompts, wherein the one or more prompts are used for instructing the language model to use multiple languages and / or call multiple tools to solve the reasoning problem; the one or more prompts are input into the language model to be processed, m candidate reasoning paths and m candidate reasoning results generated by the language model are obtained, m is an integer larger than 1, the m candidate reasoning paths and the m candidate reasoning results are in one-to-one correspondence, and m is an integer larger than 1; at least two candidate reasoning paths in the m candidate reasoning paths use different languages and / or call different tools; and determining a target reasoning result according to the m candidate reasoning results. According to the scheme, the reasoning performance of the language model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence (AI), and more specifically, to a method and apparatus for performing reasoning tasks. Background Technology

[0002] With the development of artificial intelligence, language models are being applied in increasingly wider scenarios. For example, language models have demonstrated good reasoning abilities in complex reasoning tasks such as mathematical reasoning, symbolic reasoning, and common sense reasoning. In complex reasoning tasks, techniques such as hint engineering and chain of thought are typically used to enhance the reasoning capabilities of language models.

[0003] However, current language models still have limitations in handling complex reasoning tasks, and in some scenarios, the reasoning performance of language models cannot meet the needs of practical applications.

[0004] Therefore, improving the inference performance of language models has become an urgent problem to be solved. Summary of the Invention

[0005] This application provides a method and apparatus for performing reasoning tasks, which is beneficial to improving the reasoning performance of language models.

[0006] In a first aspect, a method for performing a reasoning task is provided, comprising: receiving a reasoning problem to be solved; constructing one or more hints, wherein the one or more hints are used to instruct a language model to solve the reasoning problem using multiple languages ​​and / or calling multiple tools; inputting the one or more hints into the language model for processing to obtain m candidate reasoning paths and m candidate reasoning results generated by the language model, wherein m is an integer greater than 1, the m candidate reasoning paths and m candidate reasoning results correspond one-to-one, and at least two of the m candidate reasoning paths use different languages ​​and / or call different tools; and determining a target reasoning result based on the m candidate reasoning results.

[0007] In the solution of this application embodiment, a prompt is used to instruct the language model to use different languages ​​and / or call different tools to solve the reasoning problem. This enables the language model to generate multiple candidate reasoning paths and their corresponding candidate reasoning results, and to obtain the final reasoning result (i.e., the target reasoning result) based on the candidate reasoning results. This solution utilizes the multilingual capabilities and tool calling capabilities of the large language model, which is conducive to generating diverse candidate reasoning paths and avoids the saturation of the diversity of candidate reasoning paths generated by the large language model, thus avoiding getting stuck in a local optimum. This is beneficial to improving the performance of solving complex reasoning problems and obtaining more accurate reasoning results.

[0008] Meanwhile, the solutions in this application have a wide range of applications, do not limit the structure of the language model, and can be applied to various inference tasks without large-scale pre-training and fine-tuning.

[0009] Optionally, any two of the m candidate inference paths may use different languages ​​and / or invoke different tools.

[0010] This helps to further ensure the diversity of the generated multiple candidate inference paths. In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: filtering the m candidate inference paths and their corresponding candidate inference results based on the semantic similarity between the m candidate inference paths, or the semantic similarity between the m candidate inference paths and their corresponding candidate inference results, to obtain k candidate inference paths and k candidate inference results, where the k candidate inference paths and k candidate inference results correspond one-to-one, and k is a positive integer less than or equal to m; and determining the target inference result based on the m candidate inference results, including: determining the target inference result from the k candidate inference results.

[0011] For example, each candidate reasoning path can be translated into the same semantic space using methods such as embedding to obtain the embeddings of the m candidate reasoning paths, and the semantic similarity between the m embeddings can be calculated. For example, the semantic similarity can be calculated using methods such as cosine similarity or Jaccard similarity.

[0012] In the solution of this application embodiment, multiple generated candidate inference paths can be filtered based on semantic similarity to filter out semantically similar candidate inference paths, thereby further ensuring the diversity of candidate inference paths. Simultaneously, this helps reduce the amount of data that needs to be processed subsequently, thus improving processing efficiency.

[0013] In conjunction with the first aspect, in some implementations of the first aspect, when k is greater than 1, the semantic similarity between any two candidate inference paths among the k candidate inference paths is greater than or equal to the similarity threshold, or the semantic similarity between any two candidate inference paths and candidate inference results among the k candidate inference paths and k candidate inference results is greater than or equal to the similarity threshold.

[0014] In conjunction with the first aspect, in some implementations of the first aspect, determining the target reasoning result based on m candidate reasoning results includes: verifying multiple combinations based on the reasoning problem to obtain verification results for multiple combinations, wherein each of the multiple combinations includes one candidate reasoning path and one candidate reasoning result among j candidate reasoning paths and j candidate reasoning results, the j candidate reasoning paths belong to m candidate reasoning paths and the j candidate reasoning results belong to m candidate reasoning results, the j candidate reasoning paths and j candidate reasoning results correspond one-to-one, and j is an integer less than or equal to m and greater than 1; determining the target reasoning result from the j candidate reasoning results based on the verification results of the multiple combinations.

[0015] For example, the j candidate inference paths can be the m candidate inference paths.

[0016] Alternatively, if j is less than m, the j candidate reasoning paths can be j randomly selected from the m candidate reasoning paths.

[0017] Alternatively, when k is greater than 1, the j candidate reasoning paths and the j candidate reasoning results can be the k candidate reasoning paths and the k candidate reasoning results mentioned above.

[0018] In the solution of this application embodiment, the candidate reasoning path can be self-verified, which helps to ensure the consistency and effectiveness of the reasoning results.

[0019] In conjunction with the first aspect, in some implementations of the first aspect, determining the target inference result from j candidate inference results based on the verification results of multiple combinations includes: performing majority voting on j candidate inference results based on the weights of j candidate inference paths to determine the target inference result, wherein the weights of j candidate inference paths are determined based on the verification results of multiple combinations, the verification results of multiple combinations include multiple combinations passing verification or failing verification, and the weight of the candidate inference path in the combination that passes verification is greater than the weight of the candidate inference path in the combination that fails verification.

[0020] In conjunction with the first aspect, in some implementations of the first aspect, one or more prompts are constructed, including: constructing multiple prompts, each of the multiple prompts being used to indicate the language and / or the tool invoked by the language model in solving the reasoning problem, wherein any two of the multiple prompts indicate different languages ​​and / or tools.

[0021] In the embodiments of this application, different prompts can indicate different languages ​​and / or tools, which helps to ensure the diversity of generated candidate reasoning paths, thereby improving reasoning performance.

[0022] In conjunction with the first aspect, in some implementations of the first aspect, multiple tools include at least one of the following: a code interpreter, a calculator, a graphing tool, or an external solver; or, multiple languages ​​include at least one of the following: Chinese or English.

[0023] Secondly, an apparatus for performing a reasoning task is provided, comprising: a receiving module for receiving a reasoning problem to be solved; and a processing module for: constructing one or more prompts, wherein the one or more prompts instruct a language model to use multiple languages ​​and / or invoke multiple tools to solve the reasoning problem; inputting the one or more prompts into the language model for processing to obtain m candidate reasoning paths and m candidate reasoning results generated by the language model, wherein m is an integer greater than 1, the m candidate reasoning paths and m candidate reasoning results correspond one-to-one, and at least two of the m candidate reasoning paths use different languages ​​and / or invoke different tools; and determining a target reasoning result based on the m candidate reasoning results.

[0024] In conjunction with the second aspect, in some implementations of the second aspect, the processing module is further configured to: filter the m candidate reasoning paths and the candidate reasoning results corresponding to the m candidate reasoning paths based on the semantic similarity between the m candidate reasoning paths, or the semantic similarity between the m candidate reasoning paths and the candidate reasoning results corresponding to the m candidate reasoning paths, to obtain k candidate reasoning paths and k candidate reasoning results, wherein the k candidate reasoning paths and k candidate reasoning results correspond one-to-one, and k is a positive integer less than or equal to m; and the processing module is specifically configured to: determine the target reasoning result from the k candidate reasoning results.

[0025] In conjunction with the second aspect, in some implementations of the second aspect, when k is greater than 1, the semantic similarity between any two candidate inference paths among the k candidate inference paths is greater than or equal to the similarity threshold, or the semantic similarity between any two candidate inference paths and candidate inference results among the k candidate inference paths and k candidate inference results is greater than or equal to the similarity threshold.

[0026] In conjunction with the second aspect, in some implementations of the second aspect, the processing module is specifically used to: verify multiple combinations based on the reasoning problem to obtain verification results for multiple combinations, wherein each of the multiple combinations includes one candidate reasoning path from j candidate reasoning paths and one candidate reasoning result from j candidate reasoning results, the j candidate reasoning paths belong to m candidate reasoning paths, the j candidate reasoning results belong to m candidate reasoning results, the j candidate reasoning paths and j candidate reasoning results correspond one-to-one, and j is an integer less than or equal to m and greater than 1; and determine the target reasoning result from the j candidate reasoning results based on the verification results of the multiple combinations.

[0027] In conjunction with the second aspect, in some implementations of the second aspect, the processing module is specifically used to: perform majority voting on j candidate inference results based on the weights of j candidate inference paths to determine the target inference result, wherein the weights of the j candidate inference paths are determined based on the verification results of multiple combinations, the verification results of multiple combinations include multiple combinations that have passed verification or failed verification, and the weight of the candidate inference path in the combination that has passed verification is greater than the weight of the candidate inference path in the combination that has failed verification.

[0028] In conjunction with the second aspect, in some implementations of the second aspect, the processing module is specifically used to: construct multiple prompts, each of the multiple prompts being used to indicate the language and / or the tool invoked by the language model to solve the reasoning problem, wherein any two of the multiple prompts indicate different languages ​​and / or tools.

[0029] In conjunction with the second aspect, in some implementations of the second aspect, multiple tools include at least one of the following: a code interpreter, a calculator, a graphing tool, or an external solver; or, multiple languages ​​include at least one of the following: Chinese or English.

[0030] It should be understood that the extensions, limitations, explanations and descriptions of the relevant content in the first aspect above also apply to the same content in the second aspect.

[0031] Thirdly, a computing device is provided, including a processor and a memory, and optionally, an input / output interface. The processor controls the input / output interface to send and receive information, the memory stores a computer program, and the processor retrieves and runs the computer program from the memory, enabling the execution of the method described in the first aspect or any possible implementation thereof.

[0032] Optionally, the processor can be a general-purpose processor, which can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, integrated circuit, etc.; when implemented in software, the processor can be a general-purpose processor that reads software code stored in memory. This memory can be integrated into the processor or located outside the processor and exist independently.

[0033] Fourthly, a chip is provided that acquires and executes instructions to implement the methods described in the first aspect and any implementation thereof.

[0034] Optionally, as one implementation, the chip includes a processor and a data interface, through which the processor reads instructions stored in the memory and executes the methods in the first aspect and any implementation thereof.

[0035] Optionally, as one implementation, the chip may further include a memory storing instructions, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to perform the method in the first aspect and any implementation thereof.

[0036] Fifthly, a computer program product containing instructions is provided, which, when executed by a computing device, causes the computing device to perform the methods described in the first aspect and any implementation thereof.

[0037] In a sixth aspect, a computer-readable storage medium is provided, including computer program instructions that, when executed by a computing device, perform the method as described in the first aspect and any implementation thereof.

[0038] As examples, these computer-readable storage devices include, but are not limited to, one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), flash memory, electrically EPROM (EEPROM), and hard drive.

[0039] Alternatively, as one implementation method, the aforementioned storage medium can specifically be a non-volatile storage medium. Attached Figure Description

[0040] Figure 1 This is a schematic diagram of a system applicable to the methods described in the embodiments of this application.

[0041] Figure 2 This is a schematic diagram of a system for another method applicable to embodiments of this application.

[0042] Figure 3 This is a schematic diagram of a system for yet another method applicable to embodiments of this application.

[0043] Figure 4 This is a schematic flowchart illustrating a method for performing a reasoning task according to an embodiment of this application.

[0044] Figure 5 This is a schematic flowchart illustrating another method for performing a reasoning task according to an embodiment of this application.

[0045] Figure 6 This is a schematic diagram of the reasoning path generation process in an embodiment of this application.

[0046] Figure 7This is a schematic diagram illustrating an example of a candidate reasoning path and its corresponding candidate reasoning result for a reasoning problem according to an embodiment of this application.

[0047] Figure 8 This is a schematic diagram of the filtering process of the inference path in an embodiment of this application.

[0048] Figure 9 This is a schematic diagram illustrating an example of the execution process of the inference task in an embodiment of this application.

[0049] Figure 10 This is a schematic block diagram of an apparatus for performing a reasoning task according to an embodiment of this application.

[0050] Figure 11 This is a schematic diagram of the architecture of a computing device according to an embodiment of this application. Detailed Implementation

[0051] The technical solutions in this application will now be described with reference to the accompanying drawings.

[0052] The terminology used in the following embodiments is for the purpose of describing specific embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” and “the” are intended to include expressions such as “one or more,” unless the context clearly indicates otherwise. It should also be understood that in the following embodiments of this application, “at least one,” “at least one,” and “one or more” refer to one, two, or more than two. “First,” “second,” and various numerical designations are merely distinctions for descriptive convenience and are not intended to limit the scope of the embodiments of this application. “And / or” is used to describe the correspondence between corresponding objects, indicating that three relationships can exist. For example, “A and / or B” can represent: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character “ / ” generally indicates that the preceding and following related objects are in an “or” relationship. The order of the process numbers below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic and should not constitute any limitation on the implementation process of the embodiments of this application. For example, in the embodiments of this application, the words "301", "401", "501" etc. are merely identifiers made for the convenience of description and do not limit the order of execution steps.

[0053] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. In this application, the words "exemplary" or "for example" are used to indicate that something is illustrative, exemplary, or descriptive. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized. In the embodiments of this application, descriptions such as "when," "in the case of," "if," and "if" all refer to the fact that the device will perform a corresponding processing under certain objective circumstances, and are not a limitation on time, nor do they require the device to perform a judgment action during implementation, nor do they imply any other limitations.

[0054] In this application, "for indicating" can include both direct and indirect indication. When describing an indication message as indicating A, it can include whether the indication message directly indicates A or indirectly indicates A, but does not necessarily mean that the indication message carries A.

[0055] To facilitate understanding of the solutions in the embodiments of this application, the terms that may be involved in the embodiments of this application will be explained below.

[0056] (1) Prompt;

[0057] The prompt is the input to the large language model and is a natural language string. The prompt typically includes a task description and task input.

[0058] (2) Prompt Engineering;

[0059] Cueing engineering is a technique that uses more appropriate cues to improve the performance of large language models.

[0060] (3) Reasoning path;

[0061] The reasoning path can also be replaced by thought, which refers to a series of reasoning steps generated by the large language model to solve a specific problem, such as hypothesis, proof, deduction and induction, and conclusion.

[0062] (4) Large language model (LLM);

[0063] LLM (Learning-Based Language Model) is a deep learning-based natural language processing technique used to understand and generate natural language text. By learning from large amounts of text data, LLM can understand the syntax, semantics, and contextual information of a language, and generate text similar to human language. Large language models can be used to process natural language tasks more efficiently, improving the accuracy and efficiency of text generation and understanding.

[0064] The fundamental principle of Large Language Models (LLMs) is to train massive amounts of text data using neural networks to learn the inherent rules and patterns of language. During training, the LLM generates corresponding output text based on the input text data, and continuously adjusts the model's parameters through optimization algorithms to minimize the difference between the output text and the real text. By fine-tuning the pre-trained LLM, the model parameters are subtly adjusted to optimize performance and better adapt the model to specific domain tasks or datasets.

[0065] Large language models typically take text as input. A prompt is one form of input text. A prompt is a short text snippet used to guide the large model to generate a specific type of output. It can be in the form of a question, instruction, example, etc., providing the model with context and direction.

[0066] Figure 1 A schematic diagram of a system applicable to an embodiment of this application is shown. For example, such as... Figure 1 As shown, the system may include a user device and a data processing device. The user device can act as the initiator of data processing. The user can initiate requests through the user device. The user device can also be replaced by a client device. The user device can send the user's request to the data processing device for processing and display the processing result to the user. For example, the data processing device can be a cloud server, network server, application server, or management server, or other devices or servers with data processing capabilities. The data processing device can also be replaced by a server device. The data processing device can receive input data from the user device through an interactive interface, such as query statements / voice / text questions, and perform language data processing through a storage device for storing data and a data processing processor, such as data training, machine learning, deep learning, search, reasoning, and decision-making, for example, executing the method of the embodiments of this application. The storage device can be a general term, including local storage and a database storing historical data. The database can be located on the data processing device or on other devices.

[0067] For example, user devices may include mobile phones, tablets, wearable devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), or vehicles, etc.

[0068] For example, in this embodiment, the user equipment can send the reasoning problem to be solved to the data processing device, which can execute the method of this embodiment and feed the result back to the user equipment. Exemplarily, a cloud server is used as the data processing device. The cloud service can provide reasoning services to execute the solution of this embodiment.

[0069] Figure 2 A schematic diagram of a system applicable to another embodiment of the method described in this application is shown. For example, such as Figure 2 As shown, the system may include a user equipment. This user equipment can directly function as a data processing device, receiving input data, such as query statements / voice / text questions, and performing data processing, for example, executing the methods of the embodiments of this application. The specific process is similar to... Figure 1 The similarities are not elaborated here.

[0070] For example, the solutions of this application embodiment can be applied to user equipment. For instance, the language model of this application embodiment can be built into the user equipment, allowing the user equipment to execute the methods of this application embodiment. Alternatively, the language model of this application embodiment can be deployed in an application (APP) of the user equipment, i.e., the methods of this application embodiment can be executed by calling the APP.

[0071] Figure 3 A schematic diagram of a system applicable to yet another embodiment of the method described in this application is shown. Figure 1 or Figure 2 The user equipment in the middle can be Figure 3 Local device 301 or 302 in the middle, Figure 1 or Figure 2 The data processing device in the system can be execution device 210. The data storage system can be integrated into execution device 210 or located in the cloud or on other network servers.

[0072] Figure 4This application illustrates a method for performing a reasoning task, i.e., a method for solving a reasoning problem, provided by an embodiment of this application. In the solution of this embodiment, a prompt is constructed by combining different languages ​​and tool calls, enabling the language model to output multiple candidate reasoning paths and candidate reasoning results. This improves the diversity of candidate reasoning paths, thereby enhancing the accuracy of the candidate reasoning results.

[0073] like Figure 4 As shown, method 400 includes the following steps.

[0074] 410, Receive the reasoning problem to be processed.

[0075] 420. Construct one or more prompts. These one or more prompts are used to instruct the language model to solve the inference problem using multiple languages ​​and / or invoking multiple tools.

[0076] 430. Input the one or more prompts into the language model for processing to obtain m candidate inference paths and m candidate inference results. The m candidate inference paths and m candidate inference results correspond one-to-one. At least two of the m candidate inference paths use different languages ​​and / or invoke different tools.

[0077] 440. Determine the target reasoning result based on the m candidate reasoning results.

[0078] For example, the solution in this application embodiment can be provided by Figures 1 to 3 Execute on any of the systems in the list. Figure 1 Taking the system shown as an example, a user device (such as a client device) can receive a reasoning problem input by the user and send it to a data processing device (such as a server device). The data processing device executes method 400 to obtain the target reasoning result for the reasoning problem and returns it to the user device. The user device can then output the target reasoning result to the user.

[0079] The solutions in this application can be applied to various types of reasoning problems.

[0080] For example, the solutions in this application embodiment can be applied to complex reasoning tasks such as mathematical reasoning, common sense reasoning, symbolic reasoning, and code processing.

[0081] Taking mathematical reasoning as an example, the reasoning problem to be processed can be a mathematical problem, such as a mathematical word problem, and the candidate reasoning result can be the answer to the mathematical problem.

[0082] Taking common sense reasoning as an example, the reasoning problem to be processed can be a common sense problem, and the candidate reasoning result can be the answer to the common sense problem.

[0083] Taking code processing as an example, the reasoning problem to be processed can be a piece of code. Candidate reasoning results can indicate whether the code meets the requirements, such as whether it meets memory safety requirements, or whether there are array out-of-bounds issues, etc.

[0084] It should be understood that the above are merely examples and do not constitute a limitation on the application scenarios of the embodiments of this application. Any other problem that can be modeled as outputting candidate inference paths and candidate inference results can adopt the solutions of the embodiments of this application.

[0085] For example, the language model in the embodiments of this application can be a large language model of any structure. The embodiments of this application do not limit the structure of the language model.

[0086] The number of prompts constructed in step 420 can be n. That is, in step 420, n prompts are constructed for the reasoning problem to be solved. These n prompts are used to instruct the language model to use multiple languages ​​and / or call multiple tools to solve the reasoning problem. n is a positive integer.

[0087] In other words, the n prompts can instruct the language model to solve the reasoning problem based on multiple reasoning paths, at least two of which use different languages ​​and / or invoke different tools.

[0088] For different reasoning problems, the number of prompts (i.e., n) constructed can be the same or different.

[0089] For example, the value of n can be determined based on the complexity of the reasoning problem and / or the capabilities of the language model.

[0090] For example, the multiple languages ​​may include at least one of the following: Chinese or English, etc.

[0091] For example, the multiple tools may include at least one of the following: a code interpreter, a calculator, a graphing tool, or an external solver.

[0092] For example, a code interpreter may include at least one of the following: a C++ interpreter, a Python interpreter, or a Lean interpreter, etc.

[0093] In step 430, the m candidate inference paths are inference paths generated by the language model based on the n prompts to solve the inference problem. Each candidate inference path yields a candidate inference result. The candidate inference result corresponding to a candidate inference path can be the inference result obtained based on that candidate inference path.

[0094] For example, in step 430, the n prompts can be input into the language model respectively. The language model can generate one or more candidate reasoning paths and their corresponding candidate reasoning results for solving the reasoning problem based on each of the n prompts.

[0095] Different candidate inference paths may lead to different candidate inference results, or they may lead to the same candidate inference result.

[0096] For example, the reasoning path in the embodiments of this application may also be replaced with other descriptions such as reasoning scheme.

[0097] For different reasoning problems, the number of candidate reasoning paths (i.e., m) obtained in step 430 can be the same or different.

[0098] The instructions for these n prompts can be implemented in various ways.

[0099] As an example, the n prompts can instruct the language model to use different languages ​​and / or invoke different tools to solve reasoning problems.

[0100] For example, when n=1, the prompt can be used to instruct the language model to use different languages ​​and / or invoke different tools to solve reasoning problems.

[0101] Here is an example of a prompt.

[0102] For example, the prompt could be:

[0103] {Prompt: "Problem"}

[0104] Please use multiple languages ​​(such as Chinese or English) and utilize multiple tools (such as Python interpreters, C++ interpreters, Java interpreters, or Lean interpreters) to solve the above problem.

[0105] In the example of the prompt above, "problem" can be used to represent a reasoning problem to be solved.

[0106] It should be understood that the above are merely examples and do not constitute a limitation on the format and content of the prompt.

[0107] As another example, the n prompts can indicate the languages ​​and / or tools that the language model needs to use in solving the reasoning problem, so that the language model can use multiple languages ​​and / or invoke multiple tools to solve the reasoning problem.

[0108] In this case, the prompt can directly indicate the multiple languages ​​and / or the multiple tools. The languages ​​and / or tools used in the m candidate inference paths are the languages ​​and / or tools indicated by the n prompts.

[0109] For example, when n=1, the prompt can be used to indicate the language and / or tools that the language model needs to use in solving reasoning problems.

[0110] Here is an example of a prompt.

[0111] For example, the prompt could be:

[0112] {Prompt: "Problem"}

[0113] Please use three inference paths (i.e., m=3) to solve the above problem. The first inference path uses Chinese and calls the Python interpreter; the second inference path uses English and calls the C++ interpreter; and the third inference path uses English and calls Lean.

[0114] It should be understood that the above are merely examples and do not constitute a limitation on the format and content of the prompt.

[0115] For example, when n is greater than 1, each of the n prompts can be used to indicate the language or tool that the language model needs to use in solving the reasoning problem. At least two of the n prompts indicate different languages ​​and / or tools.

[0116] The language and / or tools used in the candidate inference paths generated based on each prompt are the language and / or tools indicated by that prompt.

[0117] Furthermore, any two of the n prompts are in different languages ​​and / or using different tools. That is, different prompts are in different languages ​​and / or using different tools.

[0118] Taking the n prompts, including prompt#1 and prompt#2, as an example, prompt#1 instructs the language model to use Chinese and call the Python interpreter to solve the reasoning problem; prompt#2 instructs the language model to use English and call the C++ interpreter to solve the reasoning problem.

[0119] Further, optionally, each of the n prompts corresponds to one of the m candidate inference paths.

[0120] In this case, n = m, and there is a one-to-one correspondence between the m prompts and the m candidate inference paths. In other words, the m candidate inference paths are generated based on the m prompts.

[0121] For example, as described above, each of the plurality of prompts can be used to indicate the language and / or tools invoked by the language model in the process of solving the reasoning problem. The language and / or tools invoked in the m candidate reasoning paths are the language and / or tools indicated by the corresponding prompts.

[0122] It should be understood that the above are merely some examples of prompts and do not constitute a limitation on the solutions of the embodiments of this application. As long as the constructed prompt enables the language model to use different languages ​​and / or call different tools to solve the reasoning problem, it is acceptable.

[0123] For example, the n prompts can be constructed according to a prompt template.

[0124] For reasoning problems, the applicable language set (such as Chinese and English) and tool set (such as calculators, code interpreters, graphing tools and external solvers) can be predefined, and a prompt can be constructed based on the prompt template.

[0125] by Figure 6 Taking the prompt template shown as an example, after obtaining the reasoning question, a prompt can be constructed based on this template. The language can be selected in the "(candidatelanguage)" field, such as Chinese or English. The "{program}" field allows selection of a program (an example of a tool) from the candidate program (candidateprogram), such as Python, C++, Java, or Lean. The candidate languages ​​are a predefined set of languages, and the candidate programs are a predefined set of tools.

[0126] For example, such as Figure 6 As shown, four prompts (n=4) are constructed based on the prompt template, each indicating a different language and tool. These four prompts are then input into the language model for inference, resulting in four outputs (m=4), i.e., four responses. Each output includes an inference path and an inference result, i.e., a candidate inference path and its corresponding candidate inference result. Figure 4As shown, the four outputs are: Reasoning Path 1 and Answer 1, Reasoning Path 2 and Answer 2, Reasoning Path 3 and Answer 3, and Reasoning Path 4 and Answer 4. These four candidate reasoning paths use different languages ​​and tools. Taking Reasoning Path 1 as an example, this reasoning path uses Chinese and calls the Python interpreter. The languages ​​and tools used by the other candidate reasoning paths are shown in the figure.

[0127] Figure 7 An example of a candidate reasoning path and its corresponding candidate reasoning result is shown for a specific reasoning problem.

[0128] like Figure 7 As shown, according to Figure 6 The prompt template shown constructs three prompts (i.e., m=3): prompt 1, prompt 2, and prompt 3. Prompt 1 indicates Chinese and Python, prompt 2 indicates English and C++, and prompt 3 indicates Chinese and Java.

[0129] The three prompts are input into the language model for reasoning to obtain three responses: response 1, response 2, and response 3. For example... Figure 7 As shown, the language and tools used in the reasoning path of the response generated based on each prompt are the language and tools indicated by that prompt.

[0130] Taking Prompt 1 and Response 1 as examples, Prompt 1 instructs the language model to use Chinese and call the Python interpreter to solve the reasoning problem. Response 1 uses Chinese and includes Python code in the reasoning path to solve the reasoning problem. Other prompts and responses are shown in the figure and will not be described further here.

[0131] It should be understood that the above is merely an example, and the n prompts can also be constructed in other ways, such as by using LLM. This application does not limit the specific construction method of the n prompts.

[0132] As mentioned earlier, at least two of the m candidate inference paths use different languages ​​and / or invoke different tools.

[0133] This helps to ensure the diversity of the generated multiple candidate inference paths.

[0134] Optionally, any two of the m candidate inference paths may use different languages ​​and / or invoke different tools.

[0135] This helps to further ensure the diversity of the multiple candidate inference paths generated.

[0136] These m candidate inference paths can be obtained in a variety of ways.

[0137] For example, the n prompts can instruct the language model to output m candidate inference paths.

[0138] Taking n=m as an example, the language model can output a candidate inference path based on each prompt.

[0139] The above are merely examples, and the specific method for obtaining the m candidate inference paths is not limited in the embodiments of this application.

[0140] Further, optionally, in method 400, the m candidate reasoning paths can be filtered, and the target reasoning result can be determined based on the candidate reasoning results corresponding to the filtered candidate reasoning paths.

[0141] The following uses two methods (Method 1 and Method 2) as examples to illustrate the filtering methods for candidate reasoning paths.

[0142] Method 1:

[0143] Optionally, method 400 may also include step 431 (not shown in the figure).

[0144] 431. Based on the semantic similarity between the m candidate reasoning paths, filter the m candidate reasoning paths to obtain k candidate reasoning paths. k is an integer less than or equal to m.

[0145] As mentioned earlier, there is a one-to-one correspondence between the m candidate inference paths and the m candidate inference results. Therefore, step 431 can also be understood as follows: based on the semantic similarity between the m candidate inference paths and the m candidate inference results, the m candidate inference paths and the m candidate inference results are filtered to obtain k candidate inference paths and k candidate inference results. There is a one-to-one correspondence between the k candidate inference paths and the k candidate inference results.

[0146] The k candidate inference paths are the k candidate inference paths that are retained from the m candidate inference paths after filtering. The k candidate inference results are the k candidate inference results that correspond to the k candidate inference paths from the m candidate inference results.

[0147] In this case, step 440 may include: determining the target inference result based on the k candidate inference results.

[0148] Optionally, step 440 may include: determining the target inference result from the k candidate inference results.

[0149] k can be a fixed value or a non-fixed value.

[0150] In step 431, semantically similar candidate reasoning paths can be filtered out from the m candidate reasoning paths.

[0151] For example, such as Figure 8 As shown in (a), m=4. These four candidate reasoning paths—reasoning path 1, reasoning path 2, reasoning path 3, and reasoning path 4—use different languages ​​and tools. A description of these four candidate reasoning paths can be found in [reference needed]. Figure 6 The relevant description is as follows. The semantic similarity between the four candidate reasoning paths is calculated, and the path is filtered based on the semantic similarity of the four candidate reasoning paths to obtain three (i.e., k=3) candidate reasoning paths, namely reasoning path 1, reasoning path 2 and reasoning path 3.

[0152] Step 431 can be achieved in a variety of ways.

[0153] For example, when k is greater than 1, the k candidate inference paths can be the baseline candidate inference path and the k-1 candidate inference path with the highest semantic similarity to the baseline candidate inference path among the m candidate inference paths. The baseline candidate inference path can be any one of the m candidate inference paths.

[0154] Alternatively, when k is greater than 1, the semantic similarity between any two candidate inference paths among the k candidate inference paths is greater than or equal to the similarity threshold.

[0155] It should be understood that "greater than or equal to the similarity threshold" can also be replaced with "greater than the similarity threshold" as needed, and this application embodiment does not limit this.

[0156] For example, after obtaining the m candidate reasoning paths, the semantic similarity between them can be calculated. If the semantic similarity between any two candidate reasoning paths is less than a similarity threshold, one of those two candidate reasoning paths can be filtered out. This filtering process is repeated to obtain the filtered candidate reasoning paths, which can then be used as the k candidate reasoning paths.

[0157] It should be understood that the above is only an example, and step 431 can be implemented in other ways. This application embodiment does not limit this.

[0158] The semantic similarity among the m candidate reasoning paths can be defined as the semantic similarity among the m candidate reasoning paths within the same semantic space. That is, the m candidate reasoning paths are translated into the same semantic space, and the semantic similarity among the m candidate reasoning paths is calculated within the same semantic space.

[0159] For example, each candidate reasoning path can be translated into the same semantic space through embedding or other methods to obtain the embeddings of the m candidate reasoning paths. For ease of description, the embeddings of the m candidate reasoning paths are referred to as the m embeddings. The semantic similarity between the m embeddings is calculated. The semantic similarity between the m embeddings is the semantic similarity between the m candidate reasoning paths.

[0160] For example, semantic similarity can be calculated using methods such as cosine similarity or Jaccard similarity.

[0161] In the solution of this application embodiment, semantically similar candidate reasoning paths can be filtered out, which helps to further ensure the diversity of candidate reasoning paths.

[0162] Method 2:

[0163] The main difference between Method 2 and Method 1 is that in Method 2, the candidate reasoning path and its corresponding candidate reasoning result can be treated as a whole and their semantic similarity can be calculated with other candidate reasoning paths and their corresponding candidate reasoning results.

[0164] Optionally, method 400 may also include step 432 (not shown in the figure).

[0165] 432. Based on the semantic similarity between the m candidate reasoning paths and their corresponding candidate reasoning results, the m candidate reasoning paths and their corresponding candidate reasoning results are filtered to obtain k candidate reasoning paths and k candidate reasoning results. These k candidate reasoning paths and k candidate reasoning results correspond one-to-one.

[0166] The k candidate reasoning paths and the k candidate reasoning results are the k candidate reasoning paths and the candidate reasoning results corresponding to the m candidate reasoning paths that are retained after filtering.

[0167] In this case, step 440 may include: determining the target inference result based on the k candidate inference results.

[0168] Optionally, step 440 may include: determining the target inference result from the k candidate inference results.

[0169] k can be a fixed value or a non-fixed value.

[0170] In step 432, semantically similar candidate inference paths and corresponding candidate inference results can be filtered out from the m candidate inference paths and their corresponding candidate inference results.

[0171] For example, such as Figure 8 As shown in (b), m=4. The descriptions of the four candidate inference paths and their corresponding candidate inference results can be found in [reference]. Figure 6 The relevant description is as follows: Calculate the semantic similarity between the four candidate reasoning paths and their corresponding candidate reasoning results, and filter based on the semantic similarity of the four candidate reasoning paths and their corresponding candidate reasoning results to obtain three (i.e., k=3) candidate reasoning paths and their corresponding candidate reasoning results, namely reasoning path 1 and answer 1, reasoning path 2 and answer 2, and reasoning path 3 and answer 3.

[0172] Step 432 can be achieved in a variety of ways.

[0173] For example, when k is greater than 1, the k candidate inference paths and their corresponding candidate inference results can be the baseline candidate inference path and its corresponding candidate inference result, as well as the candidate inference result corresponding to the k-1 candidate inference path that has the highest semantic similarity to the baseline candidate inference path and its corresponding candidate inference result among the m candidate inference paths and their corresponding candidate inference results. The baseline candidate inference path and its corresponding candidate inference result can be any candidate inference path and its corresponding candidate inference result among the m candidate inference paths and their corresponding candidate inference results.

[0174] Optionally, when k is greater than 1, the semantic similarity between any two candidate inference paths and their corresponding candidate inference results among the k candidate inference paths and their corresponding candidate inference results is greater than or equal to the similarity threshold.

[0175] It should be understood that "greater than or equal to the similarity threshold" can also be replaced with "greater than the similarity threshold" as needed, and this application embodiment does not limit this.

[0176] For example, after obtaining the m candidate reasoning paths and their corresponding candidate reasoning results, the semantic similarity between these m candidate reasoning paths and their corresponding candidate reasoning results can be calculated. If the semantic similarity between any two candidate reasoning paths and their corresponding candidate reasoning results is less than a similarity threshold, then one of these two candidate reasoning paths and their corresponding candidate reasoning results can be filtered out. This filtering process is repeated to obtain the filtered candidate reasoning paths and their corresponding candidate reasoning results, which can then be used as the k candidate reasoning paths and their corresponding candidate reasoning results.

[0177] It should be understood that the above is only an example, and step 431 can be implemented in other ways. This application embodiment does not limit this.

[0178] The semantic similarity between the m candidate reasoning paths and their corresponding candidate reasoning results can be considered as the semantic similarity between the m candidate reasoning paths and their corresponding candidate reasoning results within the same semantic space. That is, the m candidate reasoning paths and their corresponding candidate reasoning results are translated into the same semantic space, and the semantic similarity between the m candidate reasoning paths and their corresponding candidate reasoning results is calculated within the same semantic space.

[0179] For example, each candidate reasoning path and its corresponding candidate reasoning result can be translated into the same semantic space through embedding or other methods to obtain the embeddings of the m candidate reasoning paths and their corresponding candidate reasoning results. For ease of description, the embeddings of the m candidate reasoning paths and their corresponding candidate reasoning results are referred to as the m embeddings. The semantic similarity among the m embeddings is then calculated. The semantic similarity among the m embeddings is the semantic similarity between the m candidate reasoning paths and their corresponding candidate reasoning results.

[0180] In the solution of this application embodiment, semantically similar candidate reasoning paths can be filtered out, which helps to further ensure the diversity of candidate reasoning paths.

[0181] The result of the objective reasoning can be determined in a variety of ways.

[0182] As one possible implementation, the target inference result can be determined from the m candidate inference results. The following is an illustrative example of how to determine the target inference result.

[0183] For example, the target reasoning result can be randomly determined from the m candidate reasoning results.

[0184] Alternatively, the target reasoning result can be the candidate reasoning result with the largest number of candidates among the m candidate reasoning results. That is, the target reasoning result is obtained by majority voting on the m candidate reasoning results.

[0185] In other words, the most consistent candidate reasoning result is selected from the m candidate reasoning results as the target reasoning result.

[0186] Alternatively, the result of this inference can also be determined in the following way.

[0187] Optionally, method 400 may also include steps 433 and 434 (not shown in the figure).

[0188] 433. Based on a reasoning problem, multiple combinations are validated to obtain the validation results for these combinations. Each combination includes one of j candidate reasoning paths and one of j candidate reasoning results. The j candidate reasoning paths belong to the m candidate reasoning paths, and the j candidate reasoning results belong to the m candidate reasoning results. There is a one-to-one correspondence between the j candidate reasoning paths and the j candidate reasoning results. j is an integer less than or equal to m and greater than 1.

[0189] 434. Based on the verification results of the multiple combinations, determine the target reasoning result from the j candidate reasoning results.

[0190] The j candidate reasoning paths can be determined in a variety of ways.

[0191] For example, the j candidate inference paths can be the m candidate inference paths.

[0192] Alternatively, if j is less than m, the j candidate reasoning paths can be j randomly selected from the m candidate reasoning paths.

[0193] Alternatively, when k is greater than 1, the j candidate reasoning paths and the j candidate reasoning results can be the k candidate reasoning paths and the k candidate reasoning results mentioned above.

[0194] In step 434, the j candidate reasoning paths can be self-verified.

[0195] In a combination, the candidate inference paths and candidate inference results may or may not correspond.

[0196] For example, the j candidate reasoning paths and j candidate reasoning results can be randomly arranged and combined to obtain the multiple combinations.

[0197] For example, in step 434, the multiple combinations can be validated by a validation model.

[0198] For a combination to be validated, the input to the validation model may include the reasoning question, candidate reasoning paths in the combination, and candidate reasoning results. The output of the validation model can be used to determine the validation result of the combination. For example, the output of the validation model may include: the combination passes validation or fails validation. Alternatively, the output of the validation model may include the probability that the combination passes validation.

[0199] For example, the validation model can be a language model used to solve reasoning problems, or it can be other language models. For instance, the language model can call some downstream tools for validation.

[0200] For example, the validation model can be a binary classification model.

[0201] Optionally, step 434 may include: determining the target inference result by majority voting on the j candidate inference paths based on their weights. The weights of the j candidate inference paths are determined based on the verification results of the multiple combinations. The verification results of the multiple combinations include whether the multiple combinations pass or fail verification. The weights of candidate inference paths in combinations that pass verification are greater than the weights of candidate inference paths in combinations that fail verification.

[0202] For example, combination #a in the multiple combinations includes candidate inference path #a and candidate inference result #a, and combination #b in the multiple combinations includes candidate inference path #b and candidate inference result #b. The verification result of combination #a indicates that combination #a has passed verification, and the verification result of combination #b indicates that combination #b has failed verification. The weight of candidate inference path #a is higher than the weight of candidate inference path #b.

[0203] The weights of the j candidate inference paths can be used as the weights of the j candidate inference results.

[0204] Alternatively, step 434 may include: determining the target inference result from the j candidate inference results based on the scores of the j candidate inference paths. The verification result of the multiple combinations includes the probability that the multiple combinations pass verification. The scores of the j candidate inference paths are positively correlated with the probability that the multiple combinations pass verification.

[0205] For example, the candidate reasoning result with the highest score among the j candidate reasoning results can be used as the target reasoning result. The score of the same candidate reasoning result among the j candidate reasoning results can be the statistical value of the scores of all candidate reasoning paths that can obtain the candidate reasoning result among the j candidate reasoning paths, such as the average or the sum.

[0206] For example, among the j candidate inference results, 3 candidate inference results are "20" and 1 candidate inference result is "1". The statistical value of the scores of the 3 candidate inference paths corresponding to the 3 candidate inference results (i.e., "20") can be used as the score of the 3 candidate inference results. The score of the candidate inference path corresponding to the 1 candidate inference result (i.e., "1") can be used as the score of the candidate inference result.

[0207] The language model has multilingual processing capabilities, enabling it to understand and generate text in multiple languages. In addition, the large language model has tool calling capabilities, allowing it to call various integrated tools to expand its practicality and application scope.

[0208] For complex reasoning problems, hints can enable large language models to decompose complex candidate reasoning paths and call on tools such as code interpreters, calculators, graphing tools, and external solvers, which helps improve the efficiency and accuracy of solving complex reasoning problems.

[0209] In the solution of this application embodiment, the prompt instructs the language model to use different languages ​​and / or call different tools to solve the reasoning problem, so that the language model can generate multiple candidate reasoning paths and their corresponding candidate reasoning results, and obtain the final reasoning result (i.e. the target reasoning result) based on the candidate reasoning results. This solution utilizes the multilingual capabilities and tool calling capabilities of the large language model, which is conducive to generating diverse candidate reasoning paths and avoids the diversity saturation of candidate reasoning paths generated by the large language model, thus avoiding getting trapped in local optima, thereby improving the performance of solving complex reasoning problems.

[0210] Meanwhile, the solutions in this application have a wide range of applications, do not limit the structure of the language model, and can be applied to various inference tasks without large-scale pre-training and fine-tuning.

[0211] Furthermore, in the solution of this application embodiment, multiple generated candidate inference paths can be filtered based on semantic similarity to filter out semantically similar candidate inference paths, thereby further ensuring the diversity of candidate inference paths. Simultaneously, this helps reduce the amount of data that needs to be processed subsequently, thus improving processing efficiency.

[0212] Furthermore, in the solution of this application embodiment, the candidate reasoning path can be self-verified, which helps to ensure the consistency and effectiveness of the reasoning results.

[0213] Figure 5 An embodiment of this application illustrates a method for performing a reasoning task. Figure 5 The method shown can be regarded as Figure 4 This is one specific implementation of the method shown; a related description can be found in method 400. To avoid repetition, some descriptions of method 500 have been omitted.

[0214] Figure 5 The method 500 shown can be considered as including three stages: the generation stage of candidate reasoning paths, the filtering stage of candidate reasoning paths, and the verification stage of candidate reasoning paths.

[0215] During the generation phase, prompts are constructed using different languages ​​and tools to obtain multiple different candidate inference paths, each of which can yield a candidate inference result. The generation phase may include steps 510 to 530.

[0216] In the filtering phase, semantic similarity is calculated to filter out semantically similar reasoning paths. The filtering phase may include steps 540 to 550.

[0217] In the verification phase, the retained candidate inference paths and candidate inference results are combined for verification. Based on the verification results, different weights are assigned to different candidate inference paths, and a majority vote is conducted to obtain the target candidate inference result. The verification phase may include steps 560 to 570.

[0218] like Figure 5 As shown, method 500 may include the following steps.

[0219] 510, Receive the reasoning problem to be solved.

[0220] Step 510 corresponds to step 410 in method 400.

[0221] 520, build m prompts based on different languages ​​and tools.

[0222] Each of the m prompts indicates the language and tools that the language model needs to use in solving the reasoning problem. Different prompts indicate different languages ​​and / or tools.

[0223] For example, according to Figure 6 The prompt template shown constructs m inputs for language models. Each input is a sequence of prompt text. In other words, m prompts are constructed according to the prompt template.

[0224] Step 520 corresponds to step 420 in method 400. The way the prompt is constructed in step 520 is only an example; other solutions can refer to the relevant description in step 420.

[0225] 530. Input the m prompts into the language model for inference to obtain the m outputs of the language model.

[0226] A language model can reason about each input (i.e., each prompt) and obtain the model's output. Each output includes a reasoning path and a reasoning result, namely, a candidate reasoning path and its corresponding candidate reasoning result. m outputs are m candidate reasoning paths and their corresponding m candidate reasoning results.

[0227] Step 530 corresponds to step 430 in method 400.

[0228] 540, calculate the semantic similarity between the m outputs.

[0229] For each output, it is translated into the same semantic space using embedding to obtain the embedding for each output. The semantic similarity of these m embeddings is then calculated.

[0230] 550, based on the semantic similarity between the m outputs, filter the m outputs to obtain k outputs.

[0231] For example, if the semantic similarity between two of the m outputs is lower than the similarity threshold, one of the outputs can be randomly filtered out.

[0232] For example, such as Figure 9 As shown, filtering is performed based on the semantic similarity among the four outputs to obtain three outputs. A description of the filtering stage can be found in [reference needed]. Figure 8 The relevant description of (b).

[0233] Steps 540 and 550 correspond to step 432 in method 400.

[0234] It should be understood that steps 540 and 550 are merely examples. For instance, in other implementations, method 500 may also exclude steps 540 and 550, or steps 540 and 550 may be replaced by step 431 in method 400.

[0235] For example, when k=1, the candidate inference result in the output can be used as the target inference result. When k>1, steps 560 and 570 can be executed.

[0236] 560, perform self-verification on multiple combinations based on the k outputs to obtain the verification results of the multiple combinations.

[0237] For example, the inference paths and inference results from the k outputs are randomly permuted and combined to obtain multiple combinations. These multiple combinations are then fed back to the language model for validation. The validation results are categorized as valid or invalid. Inference paths in valid combinations are assigned higher weights, while inference paths in invalid combinations are assigned lower weights.

[0238] For example, such as Figure 9 As shown, the reasoning paths and results in the three outputs are randomly arranged to obtain three combinations: reasoning path 1 and answer 3, reasoning path 2 and answer 1, and reasoning path 3 and answer 2.

[0239] 570. Determine the target inference result based on the verification results of these multiple combinations.

[0240] For example, a majority vote is performed on the k inference results based on the weights of the k inference paths to obtain the target inference result.

[0241] It should be understood that steps 560 and 570 are merely examples. For instance, in other implementations, method 500 may also exclude steps 560 and 570, or steps 560 and 570 may be replaced by other implementations of method 400.

[0242] The following is combined with Figures 10 to 11 The apparatus of the embodiments of this application will be described below. It should be understood that the apparatus described below is capable of performing the methods of the foregoing embodiments of this application. To avoid unnecessary repetition, repeated descriptions will be appropriately omitted when describing the apparatus of the embodiments of this application below.

[0243] Figure 10 A schematic block diagram of an apparatus for performing reasoning tasks, as provided in an embodiment of this application, is shown. Figure 10 The device 1800 shown can be used to perform Figure 4 or Figure 5 The method shown.

[0244] like Figure 10 As shown, the device 1800 may include a receiving module 1810 and a processing module 1820.

[0245] The receiving module 1810 is used to receive the reasoning problem to be solved.

[0246] The processing module 1820 is used to: construct one or more prompts, which instruct the language model to use multiple languages ​​and / or call multiple tools to solve the reasoning problem; input the one or more prompts into the language model for processing to obtain m candidate reasoning paths and m candidate reasoning results generated by the language model, where m is an integer greater than 1, the m candidate reasoning paths and m candidate reasoning results correspond one-to-one, and at least two of the m candidate reasoning paths use different languages ​​and / or call different tools; and determine the target reasoning result based on the m candidate reasoning results.

[0247] Optionally, the processing module 1820 is further configured to: filter the m candidate reasoning paths and the candidate reasoning results corresponding to the m candidate reasoning paths based on the semantic similarity between the m candidate reasoning paths, or the semantic similarity between the m candidate reasoning paths and the candidate reasoning results corresponding to the m candidate reasoning paths, to obtain k candidate reasoning paths and k candidate reasoning results, wherein the k candidate reasoning paths and k candidate reasoning results correspond one-to-one, and k is a positive integer less than or equal to m; and the processing module 1820 is specifically configured to: determine the target reasoning result from the k candidate reasoning results.

[0248] Optionally, when k is greater than 1, the semantic similarity between any two candidate inference paths among the k candidate inference paths is greater than or equal to the similarity threshold, or the semantic similarity between any two candidate inference paths and candidate inference results among the k candidate inference paths and k candidate inference results is greater than or equal to the similarity threshold.

[0249] Optionally, the processing module 1820 is specifically used to: verify multiple combinations based on the reasoning problem to obtain verification results for multiple combinations, wherein each combination includes one candidate reasoning path from j candidate reasoning paths and one candidate reasoning result from j candidate reasoning results, the j candidate reasoning paths belong to m candidate reasoning paths, the j candidate reasoning results belong to m candidate reasoning results, the j candidate reasoning paths and j candidate reasoning results correspond one-to-one, and j is an integer less than or equal to m and greater than 1; and determine the target reasoning result from the j candidate reasoning results based on the verification results of the multiple combinations.

[0250] Optionally, the processing module 1820 is specifically used to: perform majority voting on j candidate inference results based on the weights of j candidate inference paths to determine the target inference result, wherein the weights of the j candidate inference paths are determined based on the verification results of multiple combinations, the verification results of multiple combinations include multiple combinations that have passed verification or failed verification, and the weight of the candidate inference path in the combination that has passed verification is greater than the weight of the candidate inference path in the combination that has failed verification.

[0251] Optionally, the processing module 1820 is specifically used to: construct multiple prompts, each of the multiple prompts being used to indicate the language and / or the tool invoked by the language model to solve the reasoning problem, wherein any two of the multiple prompts indicate different languages ​​and / or tools.

[0252] Optionally, the multiple tools include at least one of the following: a code interpreter, a calculator, a graphing tool, or an external solver; or, the multiple languages ​​include at least one of the following: Chinese or English.

[0253] For a detailed description, please refer to Method 400 or Method 500 mentioned above; they will not be repeated here.

[0254] Each module in device 1800 can be implemented in software or in hardware. For example, the implementation of processing module 1820 will be described below. Similarly, the implementation methods of other modules can be the same as those of processing module 1820.

[0255] As an example of a software functional unit, processing module 1820 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, processing module 1820 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed within the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.

[0256] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.

[0257] As an example of a hardware functional unit, the processing module 1820 may include at least one computing device, such as a server. Alternatively, the processing module 1820 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), or any combination thereof.

[0258] The processing module 1820 includes multiple computing devices that can be distributed within the same region or in different regions. These computing devices can be distributed within the same Availability Zone (AZ), within the same Virtual Private Cloud (VPC), or across multiple VPCs. Furthermore, the multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0259] It should be noted that the division of units in the above device is only a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. In other embodiments, the processing module 1820 can be used to execute any step in the method described above, and other modules can be used to implement any step described above. The steps that each module is responsible for implementing can be specified as needed. By having each module implement different steps described above, all functions of the device 1800 can be achieved.

[0260] Figure 11 This is a schematic block diagram of an apparatus for performing inference tasks according to an embodiment of this application. The apparatus 1900 may include a processor 1910, a transceiver 1920, and a memory 1930. The processor 1910, transceiver 1920, and memory 1930 are connected via internal interconnection paths. The memory 1930 is used to store instructions, and the processor 1910 is used to execute the instructions stored in the memory 1930 to receive / send data via the transceiver 1920. Optionally, the memory 1930 may be coupled to the processor 1910 via an interface or integrated with the processor 1910.

[0261] It should be noted that the transceiver 1920 mentioned above may include, but is not limited to, transceiver devices such as input / output interfaces, to enable communication between device 1900 and other devices or communication networks.

[0262] The memory 1930 can be a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM).

[0263] In one implementation, the processor 1910 can be a circuit with instruction read and execute capabilities, such as a central processing unit (CPU), microprocessor, or digital signal processor (DSP). In another implementation, the processor 1910 can implement certain functions through the logical relationships of hardware circuits. These logical relationships can be fixed or reconfigurable. For example, the processor 1910 can be a hardware circuit implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), such as a field-programmable gate array (FPGA). In a reconfigurable hardware circuit, the process of the processor loading a configuration document and configuring the hardware circuit can be understood as the processor loading instructions to implement some or all of the functions of the aforementioned units.

[0264] This application also provides an electronic device, which may include the above-described device 1800 or device 1900.

[0265] This application also provides a computing device cluster, which includes at least one computing device. The computing device may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smartphone. The computing device cluster includes at least one device 1900.

[0266] In some possible implementations, the memory 1930 of one or more computing devices in the computing device cluster may also store partial instructions for executing the aforementioned method. In other words, a combination of one or more computing devices can jointly execute the instructions for executing the aforementioned method.

[0267] It should be noted that the memory 1930 in different computing devices within the computing device cluster can store different instructions, each used to execute a portion of the steps described above. That is, the instructions stored in the memory 1930 of different computing devices can implement the functions of one or more modules in device 1900.

[0268] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc.

[0269] This application also provides a computer program product, which includes computer program code that, when run on a computer, causes the computer to perform the methods described in the above embodiments.

[0270] This application also provides a computer-readable medium storing program code that, when run on a computer, causes the computer to perform the methods described in the above embodiments.

[0271] This application also provides a chip, including circuitry, for performing the methods described in the above embodiments.

[0272] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules within the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, power-on erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.

[0273] It should also be understood that, in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0274] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0275] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0276] 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0277] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0278] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they 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 portion 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, ROM, RAM, magnetic disks, or optical disks.

[0279] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be covered.

Claims

1. A method of performing an inferencing task, the method comprising: The method comprises: receiving a reasoning problem to be solved; constructing one or more prompts for instructing a language model to solve the reasoning problem using multiple languages and / or invoking multiple tools; inputting the one or more prompts into the language model for processing to obtain m candidate reasoning paths and m candidate reasoning results generated by the language model, where m is an integer greater than 1, the m candidate reasoning paths and the m candidate reasoning results correspond one-to-one, and at least two of the m candidate reasoning paths use different languages and / or invoke different tools; determining a target reasoning result according to the m candidate reasoning results.

2. The method of claim 1, wherein, The method further comprises: filtering the m candidate reasoning paths and the m candidate reasoning results according to semantic similarities between the m candidate reasoning paths or between the m candidate reasoning paths and the candidate reasoning results corresponding to the m candidate reasoning paths to obtain k candidate reasoning paths and k candidate reasoning results, where the k candidate reasoning paths and the k candidate reasoning results correspond one-to-one, k is a positive integer less than or equal to m, and the determining the target reasoning result according to the m candidate reasoning results comprises: determining the target reasoning result from the k candidate reasoning results.

3. The method of claim 2, wherein, In the case where k is greater than 1, semantic similarities between any two of the k candidate reasoning paths are greater than or equal to a similarity threshold, or semantic similarities between any two of the k candidate reasoning paths and the candidate reasoning results are greater than or equal to a similarity threshold.

4. The method according to any one of claims 1 to 3, characterized in that, The determining the target reasoning result according to the m candidate reasoning results comprises: verifying a plurality of combinations according to the reasoning problem to obtain verification results of the plurality of combinations, where each combination in the plurality of combinations comprises one of j candidate reasoning paths and one of j candidate reasoning results, the j candidate reasoning paths belong to the m candidate reasoning paths, the j candidate reasoning results belong to the m candidate reasoning results, the j candidate reasoning paths and the j candidate reasoning results correspond one-to-one, and j is an integer less than or equal to m and greater than 1; determining the target reasoning result from the j candidate reasoning results according to the verification results of the plurality of combinations.

5. The method of claim 4, wherein, The determining the target reasoning result from the j candidate reasoning results according to the verification results of the plurality of combinations comprises: performing majority voting on the j candidate reasoning results according to weights of the j candidate reasoning paths to determine the target reasoning result, where the weights of the j candidate reasoning paths are determined according to the verification results of the plurality of combinations, the verification results of the plurality of combinations include verification passes or verification failures, and weights of candidate reasoning paths in combinations that pass verification are greater than weights of candidate reasoning paths in combinations that fail verification.

6. The method according to any one of claims 1 to 5, characterized in that, The constructing one or more prompts comprises: The plurality of prompts are constructed, each of the plurality of prompts is used to indicate a language and / or a tool invoked by the language model to solve the reasoning problem, and any two of the plurality of prompts indicate different languages and / or tools.

7. The method according to any one of claims 1 to 6, characterized in that, The plurality of tools include at least one of a code interpreter, a calculator, a chart tool, or an external solver, or the plurality of languages include at least one of Chinese or English.

8. An apparatus for performing an inferencing task, the apparatus comprising: The method comprises: receiving a reasoning problem to be solved; constructing one or more prompts, the one or more prompts being used to indicate that the language model solves the reasoning problem using a plurality of languages and / or invokes a plurality of tools; inputting the one or more prompts into the language model for processing to obtain m candidate reasoning paths and m candidate reasoning results generated by the language model, where m is an integer greater than 1, the m candidate reasoning paths and the m candidate reasoning results correspond one-to-one, and at least two of the m candidate reasoning paths use different languages and / or invoke different tools; determining a target reasoning result according to the m candidate reasoning results. The processing module is further configured to:

9. The apparatus of claim 8, wherein, filter the m candidate reasoning paths and the m candidate reasoning results according to semantic similarities between the m candidate reasoning paths, or between the m candidate reasoning paths and the m candidate reasoning results corresponding to the m candidate reasoning paths, to obtain k candidate reasoning paths and k candidate reasoning results, the k candidate reasoning paths and the k candidate reasoning results correspond one-to-one, k is a positive integer less than or equal to m, and the processing module is specifically configured to: determine a target reasoning result from the k candidate reasoning results. In the case where k is greater than 1, the semantic similarity between any two of the k candidate reasoning paths is greater than or equal to a similarity threshold, or the semantic similarity between any two of the k candidate reasoning paths and the k candidate reasoning results is greater than or equal to a similarity threshold.

10. The apparatus of claim 9, wherein, The processing module is specifically configured to:

11. The apparatus of any one of claims 8-10, wherein, verify a plurality of combinations based on the reasoning problem to obtain verification results of the plurality of combinations, each of the plurality of combinations includes one of j candidate reasoning paths and one of j candidate reasoning results, the j candidate reasoning paths belong to the m candidate reasoning paths, the j candidate reasoning results belong to the m candidate reasoning results, the j candidate reasoning paths and the j candidate reasoning results correspond one-to-one, j is an integer less than or equal to m and greater than 1; determine the target reasoning result from the j candidate reasoning results according to the verification results of the plurality of combinations. The processing module is specifically configured to:

12. The apparatus of claim 11, wherein, ​ The j candidate reasoning results are majority voted according to weights of the j candidate reasoning paths to determine the target reasoning result, wherein the weights of the j candidate reasoning paths are determined according to verification results of the multiple combinations, the verification results of the multiple combinations include that the multiple combinations pass verification or fail verification, and the weights of candidate reasoning paths in combinations that pass verification are greater than the weights of candidate reasoning paths in combinations that fail verification.

13. The apparatus of any one of claims 8-12, wherein, The processing module is specifically configured to: The multiple prompts are constructed, and each prompt in the multiple prompts is used to indicate a language used by the language model to solve the reasoning problem and / or a tool called.

14. The apparatus of any one of claims 8-13, wherein, The multiple tools include at least one of the following: a code interpreter, a calculator, a chart tool, or an external solver, or the multiple languages include at least one of the following: Chinese or English.

15. A computing device, comprising: The computer program product includes a computer readable medium, and the computer readable medium stores the computer program instructions.

16. A computer program product comprising instructions, characterized in that, The computer program instructions, when executed by a computing device, cause the computing device to perform the method of any one of claims 1-7.

17. A computer-readable storage medium, characterized in that, The computer program instructions, when executed by a computing device, cause the computing device to perform the method of any one of claims 1-7.