Conditional and Modal Reasoning in Large Language Models (2024)

Abstract: The reasoning abilities of large language models (LLMs) are the topic of a growing body of research in AI and cognitive science. In this paper, we probe the extent to which twenty-nine LLMs are able to distinguish logically correct inferences from logically fallacious ones. We focus on inference patterns involving conditionals (e.g., '*If* Ann has a queen, *then* Bob has a jack’) and epistemic modals (e.g., ‘Ann *might* have an ace’, ‘Bob *must* have a king’). These inferences have been of special interest to logicians, philosophers, and linguists, since they play a central role in the fundamental human ability to reason about distal possibilities. Assessing LLMs on these inferences is thus highly relevant to the question of how much the reasoning abilities of LLMs match those of humans. All the LLMs we tested make some basic mistakes with conditionals or modals, though zero-shot chain-of-thought prompting helps them make fewer mistakes. Even the best performing LLMs make basic errors in modal reasoning, display logically inconsistent judgments across inference patterns involving epistemic modals and conditionals, and give answers about complex conditional inferences that do not match reported human judgments. These results highlight gaps in basic logical reasoning in today’s LLMs.

## introduction one of the most distinctive human cognitive abilities is the ability to think about what follows if something is the case-conditional thinking-and about what might or must be the case-modal thinking @xcite . such reasoning about distal possibilities is crucial to the human capacity for planning (we try to choose the action that would bring about the best effects if we were to take it @xcite ), causal reasoning (c causes e if e wouldn't have happened if c hadn't @xcite ), retroactive evaluation, and more. with the rapid recent development of large language models (llms) that at least superficially resemble human speakers and reasoners in many respects @xcite @xcite , a natural question to ask is to what extent llms have mastered conditional and modal reasoning. in this paper, we begin to tackle this problem from the perspective of philosophers and logicians, probing the degree to which different llms have mastered the logical inference patterns characteristic of conditional and modal reasoning. for example, consider the pattern known as modus tollens (mt): 'if p, then q. not q. therefore, not p'. we tested whether llms draw inferences in accord with this pattern by prompting them with many instances of the pattern, as in: user prompt: from 'if alex finished the race, then chris finished the race' together with 'chris did not finish the race', can we infer 'alex did not finish the race'? (system prompt: answer only with 'yes' or 'no' and nothing else.) gpt-4: yes. mistral 7b: no. etc. we then gave other instances of the pattern to each llm, asssessing their performance in terms of accuracy on the pattern of inference. figure 1 summarizes performance across several inference patterns to be discussed. we also compared performance on the zero-shot condition shown above with few-shot and chain-of-thought conditions ( after providing some background in § 2 and detailing our experimental setup in § 3, we discuss results for a number of inference patterns in § 4. we find that among the llms tested, all models commit basic fallacies in reasoning with modals and conditionals. even the best performing models display logically inconsistent judgments across certain inference patterns involving modals and conditionals. and almost all models give answers to certain complex conditional inferences that do not match reported human judgments. we also show that models' performance on our reasoning tasks is highly correlated with that of chatbot arena elo ratings @xcite , mmlu @xcite , and gsm8k @xcite , supporting the hypothesis that logical reasoning abilities are predictive of general model capabilities and performance on downstream tasks. in sum, our main contributions in this paper are: our goal is to apply methodologies from the philosophical, logical, and linguistic literature on conditionals and modals to the study of llms. ## discussion on the one hand, our results mirror what we have learned in the field over the past few years: larger models are likely to perform better at reasoning, and chain-of-thought prompting often but does not always help. on the other hand, we have identified inconsistent and counterintuitive reasoning behaviors from even the best models with and without chain-of-thought. the inference patterns that give rise to those behaviors reflect state-of-the-art research in philosophy and logic, which by their nature means they are less present in the training and fine-tuning data of llms (though most likely not absent). this is suggestive of sources from which we can acquire more out-of-distribution evaluation data to test llms, and it illustrates that llms' judgments may not be reliable when they encounter novel inference patterns, even if those are natural and intuitive for humans. lastly, we note that a neurosymbolic, semantic-parsing approach to logical reasoning, as in olausson et al. 2023, will not automatically handle the tasks we present here. to our knowledge, theorem provers do not natively implement the nuanced meaning representations we discussed in this paper, and in some cases it is still controversial what the correct semantics for certain modal operators are. thus, working towards an automated natural language reasoning system that sensibly solves our tasks is a challenge regardless of the models and approaches. ## conclusion we have drawn on philosophical, logical, and linguistic analyses of inference to explore the extent to which current llms are accurate logical reasoners about conditionals and modals. we hope this will be the start of a new strand of research on llms. there are many natural follow-ups. first, it would be interesting to compare the behavior of llms with experimental human subjects on all the inferences we tested. we have reported expert human judgments from the literature, but the judgments of experimental subjects might exhibit mistakes interestingly similar to or different from those we find in llms. second, there are many more inference patterns to explore, involving modals, conditionals, as well as many other logical constructions, like quantifiers, attitude predicates, and degree constructions. third, modal and conditional reasoning is also connected to probabilistic reasoning, causal models, and mental simulations, and hence could provide another perspective for studying these in llms and humans. more generally, we hope that there will be more work studying llms using philosophical, linguistic, and logical insights into the building blocks of reasoning and meaning.