Prompt-based logical reasoning method and system, electronic equipment and intelligent robot
Through the Logic-of-Thought (LoT) method, the problem of information loss in the neural symbol method is solved through three steps: logical extraction, expansion and translation, and more accurate and efficient logical reasoning is achieved, which significantly improves the performance of multiple data sets.
Patent Information
- Application Number
- CN202510224112.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-06-06
AI Technical Summary
Existing neural symbolic methods are prone to information loss during logical reasoning, resulting in inference failure. Especially in semantic rich texts, symbol solvers cannot obtain potential common sense information.
A prompt-based logical reasoning method is proposed, called Logic-of-Thought (LoT). This method extracts logical expressions from natural language text through three steps: logical extraction, logical extension and logical translation, expands new logical expressions, and translates them back to natural language as an expansion of the original text.
The LoT method gets rid of the complete dependence on the symbol solver, solves the problem of information loss, significantly improves the accuracy and efficiency of logical reasoning, and can seamlessly integrate with existing prompt methods such as CoT and ToT, and improves the performance of multiple logical reasoning data sets.
Smart Images

Figure CN120106220A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence and logical reasoning technology, and specifically to a prompt-based logical reasoning method and system, electronic equipment, and intelligent robots. Background Art
[0002] Embodied robots are intelligent entities that can interact with the environment, make plans, make decisions, act, and execute tasks autonomously, just like humans. Through the application of large-scale model technology, this type of robot has significantly improved its intelligence level in the field of industrial manufacturing, achieving efficient and precise operations.
[0003] In the embodied robot scenario, there are many planning tasks that require the use of logical reasoning. However, using large models directly for reasoning often leads to problems such as hallucinations and forgetfulness, so researchers have proposed various methods to improve the reasoning ability of large models.
[0004] For example, US Pat. No. 11931894B1 describes a robot control system and method that utilizes one or more large language models (LLMs) to achieve at least some degree of autonomy. Among them, robot control parameters and / or instructions can be advantageously specified in natural language (NL) and communicated with LLM through NL prompts or queries. The NL response from the LLM can then be converted into robot control parameters and / or instructions. In this way, the robot control system can utilize LLM to enhance the autonomy of various operations and / or functions, including but not limited to task planning, motion planning, human interaction and / or reasoning about the environment. The method also includes generating an NL description of an instruction set by at least one processor, and generating an NL description of the instruction set may include executing a robot language conversion module, which generates an NL description of each instruction in the instruction set. The robot language conversion module may include a text string matching module, which is operable to compare the robot language instructions in the instruction set with the natural language vocabulary representing the actions executable by the robot system, and identify matching text strings to be included in the NL description of the robot language.
[0005] Chinese patent application CN118798367A describes a method for reasoning and generating knowledge-intensive problems based on LLM. This method interweaves retrieval with the reasoning chain in the thinking chain, uses the thinking chain to guide retrieval, and then in turn uses the retrieval results to improve the reasoning trajectory in the thinking chain to optimize the reasoning process. Its CoT-LLM reasoning module selects appropriate demonstrations from the complete set of constructed Chain-of-Thought (CoT) as contextual learning examples for LLM, so that LLM can better understand the task and generate more accurate reasoning chains; by interweaving retrieval with Chain-of-Thought (CoT), the application realizes a two-way interaction between retrieval and reasoning. Even if unsolvable problems are encountered during the reasoning process, the retrieval results can be used to dynamically improve the reasoning trajectory in the thought chain, thereby improving the thought chain and enhancing the flexibility and accuracy of the thought chain; its knowledge base retrieval module adopts a double-layer retriever, taking into account the lexical information and deeper semantic information of the text paragraph at the same time, so as to retrieve sub-problems in the reasoning chain to retrieve information that is highly relevant to the problem; on this basis, the retrieval information is further evaluated and matched through the retrieval evaluation module to ensure that only high-quality retrieval information is used to improve the thought chain. At the same time, skipping the modification of the sub-chain according to the matching degree can also improve the reasoning efficiency of the entire framework to a certain extent; the generation module trains the model through supervised fine-tuning so that the generation model acquires the ability to distinguish interference information, which helps to improve the robustness of the model to inaccurate retrieval results during generation.
[0006] The NL description in the first solution is a kind of prompt. A prompt is a guiding text or symbol that instructs LLMs on how to respond to user requests. The Chain-of-Thought (CoT) method in the second solution guides LLMs to generate intermediate steps in the reasoning process and perform reasoning in a step-by-step manner to enhance the reasoning ability of LLMs. Many subsequent studies have further improved the design of prompts based on CoT, such as Lambada, Divide-and-Conquer, Least-to-Most prompting, etc., which split the reasoning chain into multiple stages or decompose it into sub-problems, and control the generation ability of LLMs at a finer granularity to enhance the rationality of LLMs reasoning.
[0007] Some researchers simulate the human reasoning process by building more complex thinking structures. Tree-of-Thoughts (ToT) builds a tree-like thinking structure, explores more reasoning branches at each step, and can backtrack. Graph-of-Thoughts (GoT) proposes a graph-like thinking structure and supports the aggregation of multiple thoughts into new thoughts, which cyclically enhances reasoning ability. STaR and Self-Consistency with Chain-of-Thought (CoT-SC) generate multiple chains of thoughts or reasoning paths and select the best consistent answer from them.
[0008] These works have reduced the impact of hallucination problems on the logical reasoning of LLMs to a certain extent, but some studies have found that there is a lack of reliable guarantees in the reasoning process of prompting methods such as CoT, and the answers generated by LLMs are not faithful to the actual reasoning process of the model in some cases.
[0009] In order to address the challenge of poor reliability in the reasoning process, researchers have proposed many neural symbolic methods that combine LLMs with symbolic reasoning, symbolize the process of logical reasoning, and solve logical problems through symbolic calculations. Studies such as Faithful-CoT, LINC, Logic-LM, and SatLM transform the logical reasoning process of LLMs into symbolic calculations. These methods follow a similar process: first, the problem and goal are converted into symbolic expressions. Subsequently, the symbolic results are calculated through external tools such as symbolic provers. Finally, LLMs or translators are used to interpret the symbolic results. This not only takes advantage of the powerful ability of LLMs to extract information, but also uses symbolic provers to ensure the correctness of reasoning.
[0010] However, the current neural symbolic method has a disadvantage: due to the limited capabilities of the symbolic solver, the symbol extraction process can easily cause information loss, leading to reasoning failure. Especially in semantically rich texts, sometimes correct reasoning requires the use of underlying common sense information, and the symbolic solver cannot obtain the symbolic expression of this information, resulting in the inability to reason out the correct results.
[0011] Therefore, it is necessary to develop a new prompt-based logical reasoning method and system to address the current defects and shortcomings. Summary of the invention
[0012] In view of this, the main purpose of this application is to provide a prompt-based logical reasoning method, system and intelligent robot, in order to at least partially solve the above-mentioned technical problems.
[0013] In order to achieve the above purpose, as a first aspect of the present application, a prompt-based logical reasoning method is proposed, comprising the following steps:
[0014] Logical extraction step: According to the set rules, a large language model is used to extract propositions representing synonymy, antonymy and logical relationships from the natural language text to be processed, and logical symbols and logical expressions are used to represent them;
[0015] Logical expansion step: based on the logical expansion rule, a new logical expression is expanded from the obtained logical expression;
[0016] Logical translation step: using a large language model to translate the new logical expression into natural language text as an additional expansion of the natural language text to be processed.
[0017] As a second aspect of the present application, a prompt-based logical reasoning system is also proposed, comprising:
[0018] The logic extraction module is used to extract propositions representing synonymy, antonymy and logical relations from the natural language text to be processed using a large language model according to the set rules, and to express them using logical symbols and logical expressions;
[0019] A logic expansion module, used for expanding a new logic expression from the logic expression obtained by the logic extraction module based on a logic expansion rule;
[0020] The logic translation module is used to translate the new logic expression into natural language text by using a large language model as an expansion of the natural language text to be processed.
[0021] As a third aspect of the present application, an electronic device is also proposed, comprising:
[0022] a memory for storing a computer program executable on the processor;
[0023] A processor is used to execute the computer program stored in the memory to implement the prompt-based logical reasoning method as described above.
[0024] As a fourth aspect of the present application, a processor executable program is also proposed, which can be directly executed by a processor or can be executed by a processor after being compiled, and is used to execute the prompt-based logical reasoning method as described above.
[0025] As a fifth aspect of the present application, a storage medium is also proposed, on which is stored a non-volatile program code that is executable by a processor or executable after compilation, and the program code is used to execute the prompt-based logical reasoning method as described above.
[0026] As the sixth aspect of the present application, an intelligent robot is also proposed, in which the control system adopts the prompt-based logical reasoning method as described above to achieve logical reasoning.
[0027] Based on the above technical solutions, it can be seen that the prompt-based logical reasoning method, system and intelligent robot of the present application have at least one of the following beneficial effects compared with the prior art:
[0028] 1. The LoT (Logic-of-Thought) method of this application gets rid of the complete dependence on the symbolic solver and solves the information loss problem inherent in the neural symbolic method. In addition, the LoT method of this application is based on the prompt method, does not rely on external tools and other models, and is orthogonal to the existing prompt methods such as CoT (Chain-of-Thought) and ToT (Tree-of-Thoughts), and can be used in combination with a wide range of methods.
[0029] 2. On five logical reasoning datasets, the LoT method of this application is fully experimentally compared with the current mainstream prompting methods (such as CoT, ToT, and CoT-SC). The experimental results show that the LoT method of this application can be seamlessly integrated with the existing prompting methods and significantly improve their performance on all logical reasoning datasets. Specifically, LoT significantly enhances the performance of CoT on the ReClor dataset, improving the accuracy by +4.35%; improves the performance of SC on the ReClor dataset by +6.52%; and improves the performance of ToT on the complex multi-step reasoning dataset ProofWriter by +8.00%.
[0030] 3. The LoT method of this application has good scalability and can be applied to various data processing scenarios that require logical reasoning. It can be further combined with hardware to form a more efficient and intelligent robot, or even an embodied robot. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments are briefly introduced below.
[0032] Figure 1 is a flow chart of the prompt-based logical reasoning method of the present application;
[0033] Figure 2 It is an operation diagram of the actual processing process of the prompt-based logical reasoning method of Example 1 of the present application;
[0034] Figure 3 It is a framework diagram of the prompt-based logical reasoning system of the present application;
[0035] Figure 4 is a schematic diagram of the structure of the electronic device of the present application;
[0036] Figure 5 It is a schematic diagram of the structure of the computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0037] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0038] The terms used in this application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0039] In this article, some terms have the following meanings:
[0040] Artificial Intelligence (AI) is an important driving force for the new round of scientific and technological revolution and industrial transformation. It is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. In a broad sense, artificial intelligence (AI) refers to any simulated human behavior presented by a machine or system. The most basic form of AI is to program computers so that they can "simulate" human behavior based on massive data collected from similar behaviors in the past.
[0041] Embodied Artificial Inteligence (Embodied Inteligence, Embodied AI), also known as "embodied AI" and "embodied artificial intelligence", refers to the creation of an intelligent entity that combines software and hardware.
[0042] An embodied artificial intelligence system (AI System) refers to an intelligent system that perceives and acts based on a physical body. It obtains information, understands problems, makes decisions, and takes actions through the interaction between the intelligent agent and the environment, thereby generating intelligent behavior and adaptability.
[0043] Large Language Model (LLM) refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. Large language models can handle a variety of natural language tasks, such as text classification, question answering, and dialogue, and are an important path to artificial intelligence. Currently, large language models use a Transformer architecture and pre-training objectives (such as Language Modeling) similar to small models. The difference from small models is that they increase model size, training data, and computing resources.
[0044] The Transformer model is an artificial intelligence model for natural language processing that is designed to process sequences of words, such as sentences or paragraphs. LLMs such as the Generative Pretrained Transformer (gpt) model and the Bidirectional Encoder Representation Transformer (BERT) model have been pre-trained on large amounts of data in almost all fields of art and science.
[0045] In this application, the inventor uses a relatively mature large language model of OpenAI, such as gpt-3.5-turbo or gpt-4, and calls it through the completion interface. At the same time, in order to simplify the training and operation of the model, the scale of the large model can be optimized, and a smaller decoding sampling top_p parameter and temperature coefficient temperature parameter can be set in the interface to enable it to be applied to the logical reasoning of the embodied robot, ensuring sufficient reaction speed and efficiency in removing hallucinations.
[0046] When the embodied robot is planning a task, it needs to use additional logical reasoning methods to help the large model reason. If the neural symbolic method is used, information loss will occur.
[0047] In order to solve the information loss problem of neural symbolic methods, the applicant proposed an innovative symbolic prompting technology Logic-of-Thought (LoT). Specifically, LoT first extracts propositions and logical relations from the context and converts them into logical symbols and expressions; then, these expressions are expanded through the reasoning rules of propositional logic; finally, the expanded new expressions are translated back into natural language with logical information as an additional expansion of the original text. In this way, the LoT method not only retains the original input text, but also adds new logical information to help LLMs reason correctly. Therefore, the LoT method gets rid of the complete dependence on symbolic solvers and solves the information loss problem inherent in neural symbolic methods. In addition, the LoT method is based on the prompting method without the help of external tools and other models. It is orthogonal to existing prompting methods such as CoT and ToT, and can be used in combination with a wide range of methods.
[0048] The prompt-based logical reasoning method of this application specifically includes the following components:
[0049] 1. The method consists of three steps: Logic Extraction, Logic Extension, and Logic Translation. Among them:
[0050] Logical extraction: The subject is a large model, the action object is natural language text, and the result is logical symbols and logical expressions.
[0051] Logical extension: The subject is the logical extension program, the action object is the logical expression, and the result is a new logical expression.
[0052] Logical translation: The subject is a large model, the action object is logical symbols and expressions, and the result is natural language text.
[0053] 2. Relationship between each step: sequential series relationship. Logical extraction extracts propositions that represent synonymy / antonymy semantics (if any) and logical relationships from natural language text, and uses logical symbols and logical expressions to represent them. Logical expansion expands new logical expressions from logical expressions. Logical translation translates new expressions into natural language text.
[0054] 3. Steps of refinement:
[0055] Logic extraction: In the logic extraction stage, concise and effective prompts are designed, and LLMs are used to extract propositions and logical expressions from the input text in two steps. First, LLMs are instructed to select text segments containing conditional logic information from the input text. Subsequently, LLMs are used to extract the proposition symbol set □ and the logical expression set ℰ from these sentences. During the logic extraction process, LLMs identify propositions with similar meanings and represent them using the same proposition symbol. For propositions that express opposite semantics, a negation symbol "¬" is added in front. At the same time, LLMs analyze the logical relationship between propositions from the natural language text of the proposition. When there is a conditional relationship between two propositions, the symbol "→" is used to connect their corresponding proposition symbols.
[0056] Logical extension: In the logical extension stage, logical reasoning is performed according to three logical reasoning laws (double negation law, opposition law, and transmission law). The applicant has programmed the three logical reasoning laws by writing a program, and can accurately and quickly infer the hidden logical relationship formula.
[0057] Logical translation: In the logical translation stage, LLMs are used to translate the expanded hidden logical expressions into natural language descriptions. According to the form of the logical expression, the natural language descriptions of the propositional symbols are combined. After the above process, the newly added information text is added to the original text, and the semantics is enhanced without losing the original text information. This can help LLMs understand the semantics and answer questions based on richer information.
[0058] 4. The relationship between data structure and steps: The logical extraction step converts data from natural language text format to symbolic expression format, and the data structure is a set structure; the logical expansion step receives symbolic expressions and outputs symbolic expressions, and the data structure is also a set structure; the logical translation step converts symbolic expressions into natural language text format.
[0059] 5. The relationship between data structure and actual processing object: The actual processing object is in natural language text format, and the data structure changes from natural language text to symbolic expression and then to natural language text.
[0060] The above steps have no hardware requirements and are therefore very versatile and scalable.
[0061] Therefore, specifically, Figure 1 As shown, this application proposes a prompt-based logical reasoning method, comprising the following steps:
[0062] Logic Extraction step: According to the set rules, a large language model is used to extract propositions that represent synonymy / antonymy semantics and logical relationships from the natural language text to be processed, and they are represented by logical symbols and logical expressions;
[0063] Logic Extension step: based on logic extension rules, a new logic expression is extended from the obtained logic expression;
[0064] Logic Translation step: using a large language model to translate the new logic expression into a natural language text as an additional expansion of the natural language text to be processed.
[0065] Among them, in the logic extraction step, propositions and logical expressions are extracted from the input text using a large language model through two steps: (1) instructing the large language model to select text segments containing conditional logic information from the input text and construct a proposition symbol set □ and a logical expression set ℰ; in the logic extraction process, the large language model identifies propositions with similar meanings and uses the same proposition symbol to represent them; for propositions expressing opposite semantics, a negation symbol "¬" is added in front; (2) the large language model analyzes the logical relationship between propositions from the natural language text of the propositions. When there is a conditional relationship between two propositions, the symbol "→" is used to connect their corresponding proposition symbols.
[0066] Among them, in the logic expansion step, the logic expansion rules include three logical reasoning laws, namely, the double negation law, the opposition law, and the transmission law. The inventors have realized the programming of the three logical reasoning laws by writing a program, and can accurately and quickly infer the hidden logical relationship.
[0067] Among them, in the logic extraction step and the logic translation step, the type of the large language model is OpenAI's gpt-3.5-turbo or gpt-4.
[0068] The large language model is called through the completion interface, in which, for example, a decoding sampling top_p parameter is set to 1 and a temperature coefficient temperature parameter is set to 1.
[0069] In the logic translation step, the large language model is used to translate the expanded hidden logic expression into natural language text. According to the form of the logic expression, the natural language description of the proposition symbol is combined. After the above process, the newly added information text is added to the original text, and the semantic enhancement is completed without losing the original text information. This can help the large language model understand the semantics and answer questions based on richer information.
[0070] like Figure 3 As shown, the present application also proposes a prompt-based logical reasoning system, including:
[0071] The Logic Extraction module is used to extract logical symbols and expressions from the natural language text to be processed according to the set rules and using a large language model;
[0072] A logic extension module, used for extending a new logic expression from the obtained logic expression based on a logic extension rule;
[0073] A logic translation module is used to translate the new logic expression into a natural language text by using a large language model as an additional expansion of the natural language text to be processed.
[0074] The present application also provides an electronic device, which may include at least one processor; and at least one memory communicatively connected to the processor; wherein the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the prompt-based logical reasoning method of the present application as described above.
[0075] like Figure 4 As shown, the electronic device of the present application includes a processor 31, a memory 32, and a storage space 33 for storing program codes. The storage space 33 for storing program codes contains a program code 34 for executing the prompt-based logical reasoning method according to the present application, and the program code is used to execute the aforementioned method and / or steps.
[0076] like Figure 5 As shown, the present application also proposes a non-transitory computer-readable storage medium, which stores a program code (computer instruction) 41, and the program code (computer instruction) 41 is used to execute the prompt-based logical reasoning method according to the present application.
[0077] The above-mentioned computer-readable storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ReadOnly Memory, ROM), an erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM) or flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program code, which can be used by an instruction execution system, a device or a device or used in combination with it.
[0078] Computer-readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0079] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0080] The computer program code for executing the method of the present application can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, Python, etc., and also conventional procedural programming languages, such as C language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).
[0081] The present application also proposes an intelligent robot, in which the control system adopts the prompt-based logical reasoning method as described above to implement logical reasoning, thereby improving the system's ability to resist hallucinations.
[0082] Wherein, the intelligent robot can be a humanoid robot or an embodied robot.
[0083] The present application will be further described below through specific examples. It should be noted that the following examples are only for illustration and are not intended to limit the present application.
[0084] Example 1
[0085] like Figure 2As shown in the figure, LLMs extract the same meaning description "be able to use acomputer", symbolized by B, and two other propositions A and C from two different sentences. Then, it is analyzed that "¬A" is a sufficient condition for "¬B", and "¬B" is a sufficient condition for "¬C", thereby establishing two logical expressions: "¬A → ¬B" and "¬B → ¬C".
[0086] The extracted logical expressions (¬A → ¬B) and (¬B → ¬C) are used as input and expanded through three logical rules to generate the hidden expression (C → A). Even when faced with more hidden relational expressions and more complex reasoning steps in complex problems, the logic expansion program can still infer the hidden expression at an extremely fast speed and with 100% accuracy.
[0087] By associating C with its description “be able to write your essay using a word processing program”, associating A with its description “have keyboarding skills”, and associating “→” with the logical description “if…then…”, we can translate the above logical expression C →A back to its natural language description and add it as new input text to the original text.
[0088] The code can be run in Python=3.10 environment.
[0089] The required libraries are OpenAI==1.30.1
[0090] numpy
[0091] langchain
[0092] langchain_openai
[0093] langchain_core
[0094] The specific type of large model called is OpenAI's gpt-3.5-turbo or gpt-4, which is called through the completion interface. In the interface, the decoding sampling top_p parameter is set to 1 and the temperature coefficient temperature parameter is set to 1.
[0095] By setting a lower temperature when using the large model in the logic extraction stage, the standardization of the large model's answers can be improved, ensuring that the large model parses the semantics according to the analysis method required in the prompt, thereby enabling the method of this application to be implemented at lower training and computing costs.
[0096] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0097] In the description of the present application, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In the present application, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in the present application and the features of the different embodiments or examples, without contradicting each other.
[0098] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0099] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0100] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A prompt-based logical reasoning method, characterized in that: The steps include: Logical extraction step: According to the set rules, a large language model is used to extract propositions representing synonymy, antonymy and logical relationships from the natural language text to be processed, and logical symbols and logical expressions are used to represent them; Logical expansion step: based on the logical expansion rule, a new logical expression is expanded from the obtained logical expression; Logical translation step: using a large language model to translate the new logical expression into natural language text as an additional expansion of the natural language text to be processed.
2. The logical reasoning method according to claim 1, characterized in that: The logic extraction step specifically includes: (1) Using a large language model, text segments containing conditional logic information are selected from the natural language text to be processed, propositions with similar and opposite meanings are identified, and represented by proposition symbols. For propositions expressing opposite semantics, a logical symbol of negation "¬" is added in front of them. (2) Use the large language model to analyze the logical relationship between the propositions in the natural language text where the selected propositions are located. When there is a conditional relationship between two propositions, use the symbol "→" to connect the corresponding proposition symbols to form a logical expression.
3. The logical reasoning method according to claim 2, characterized in that: In the step of identifying propositions with similar and opposite meanings, the identification results are used to construct a proposition symbol set □ and a logical expression set .
4. The logical reasoning method according to claim 1, characterized in that: In the logic extension step, the logic extension rules include three logical reasoning laws: double negation law, opposition law, and transmission law; among them, The law of double negation: ¬¬p⇔p; Opposition law: (p→q)⇔(¬q→¬p); Transfer law: (p→q)∧(q→r)⇒(p→r); Among them, p, q, and r represent different propositions respectively, "¬" represents negation, "→" represents that there is a conditional relationship between two propositions, "∧" represents that two conditional relationships exist at the same time, and " " indicates bidirectional derivation, " ” indicates forward derivation.
5. The logical reasoning method according to claim 1, characterized in that: In the logic extraction step and the logic translation step, the type of the large language model is OpenAI's gpt-3.5-turbo or gpt-4; The large language model is called through the completion interface, in which the decoding sampling top_p parameter is set to 1 and the temperature coefficient temperature parameter is set to 1; In the logic translation step, the expanded new logic expression is translated into natural language text using a large language model, wherein the natural language descriptions of the proposition symbols are combined according to the form of the logic expression to obtain a new natural language text.
6. A prompt-based logical reasoning system, characterized in that: include: The logic extraction module is used to extract propositions representing synonymy, antonymy and logical relations from the natural language text to be processed using a large language model according to the set rules, and to express them using logical symbols and logical expressions; A logic expansion module, used for expanding a new logic expression from the logic expression obtained by the logic extraction module based on a logic expansion rule; The logic translation module is used to translate the new logic expression into natural language text by using a large language model as an expansion of the natural language text to be processed.
7. An electronic device, characterized in that: include: a memory for storing a computer program executable on the processor; A processor, configured to execute a computer program stored in the memory to implement the prompt-based logical reasoning method as described in any one of claims 1 to 5.
8. A processor executable program, which can be directly executed by a processor or can be executed by a processor after being compiled, and is used to execute the prompt-based logical reasoning method as described in any one of claims 1 to 5.
9. A storage medium, characterized in that: The storage medium stores non-volatile program code that is executable by a processor or executable after compilation, and the program code is used to execute the prompt-based logical reasoning method as described in any one of claims 1-5.
10. An intelligent robot, wherein the control system thereof adopts the prompt-based logical reasoning method as claimed in any one of claims 1 to 5 to realize logical reasoning; in, The intelligent robot is a humanoid robot or an embodied robot.
Citation Information
Patent Citations
Knowledge intensive question reasoning and generating method based on LLM
CN118798367A
Robot systems, methods, control modules, and computer program products that leverage large language models
US11931894B1