A Study of Modus Ponens in Transformer Models

Paulo Pirozelli, Fabio G. Cozman
Proceedings of the International Conference on Neuro-symbolic Systems, PMLR 288:293-315, 2025.

Abstract

Transformer models are the backbone of modern natural language processing. However, whether they can truly perform logical reasoning remains uncertain. This paper examines transformers’ capacity for logical inference in a controlled setting, isolating a single rule—modus ponens—and eliminating confounding factors such as semantic knowledge and linguistic complexity. We systematically vary architectural components, specifically the number of attention heads and layers, to assess their impact on logical inference. Our results show that attention heads enhance information propagation, whereas deeper architectures accelerate convergence but also introduce potentially redundant parameters. While transformers successfully handle level-2 inference tasks, their difficulties with higher-level and out-of-distribution problems suggest that they rely on heuristic “shortcuts” rather than explicit multi-step reasoning. Analysis of attention maps and ablation experiments indicates that these shortcuts function similarly to a matching-aggregation algorithm, where attention heads identify inference links, and the feed-forward network verifies if they form a valid chain. These findings highlight fundamental limitations in transformers’ ability to perform structured logical reasoning.

Cite this Paper


BibTeX
@InProceedings{pmlr-v288-pirozelli25a, title = {A Study of Modus Ponens in Transformer Models}, author = {Pirozelli, Paulo and Cozman, Fabio G.}, booktitle = {Proceedings of the International Conference on Neuro-symbolic Systems}, pages = {293--315}, year = {2025}, editor = {Pappas, George and Ravikumar, Pradeep and Seshia, Sanjit A.}, volume = {288}, series = {Proceedings of Machine Learning Research}, month = {28--30 May}, publisher = {PMLR}, pdf = {https://raw.githubusercontent.com/mlresearch/v288/main/assets/pirozelli25a/pirozelli25a.pdf}, url = {https://proceedings.mlr.press/v288/pirozelli25a.html}, abstract = {Transformer models are the backbone of modern natural language processing. However, whether they can truly perform logical reasoning remains uncertain. This paper examines transformers’ capacity for logical inference in a controlled setting, isolating a single rule—modus ponens—and eliminating confounding factors such as semantic knowledge and linguistic complexity. We systematically vary architectural components, specifically the number of attention heads and layers, to assess their impact on logical inference. Our results show that attention heads enhance information propagation, whereas deeper architectures accelerate convergence but also introduce potentially redundant parameters. While transformers successfully handle level-2 inference tasks, their difficulties with higher-level and out-of-distribution problems suggest that they rely on heuristic “shortcuts” rather than explicit multi-step reasoning. Analysis of attention maps and ablation experiments indicates that these shortcuts function similarly to a matching-aggregation algorithm, where attention heads identify inference links, and the feed-forward network verifies if they form a valid chain. These findings highlight fundamental limitations in transformers’ ability to perform structured logical reasoning.} }
Endnote
%0 Conference Paper %T A Study of Modus Ponens in Transformer Models %A Paulo Pirozelli %A Fabio G. Cozman %B Proceedings of the International Conference on Neuro-symbolic Systems %C Proceedings of Machine Learning Research %D 2025 %E George Pappas %E Pradeep Ravikumar %E Sanjit A. Seshia %F pmlr-v288-pirozelli25a %I PMLR %P 293--315 %U https://proceedings.mlr.press/v288/pirozelli25a.html %V 288 %X Transformer models are the backbone of modern natural language processing. However, whether they can truly perform logical reasoning remains uncertain. This paper examines transformers’ capacity for logical inference in a controlled setting, isolating a single rule—modus ponens—and eliminating confounding factors such as semantic knowledge and linguistic complexity. We systematically vary architectural components, specifically the number of attention heads and layers, to assess their impact on logical inference. Our results show that attention heads enhance information propagation, whereas deeper architectures accelerate convergence but also introduce potentially redundant parameters. While transformers successfully handle level-2 inference tasks, their difficulties with higher-level and out-of-distribution problems suggest that they rely on heuristic “shortcuts” rather than explicit multi-step reasoning. Analysis of attention maps and ablation experiments indicates that these shortcuts function similarly to a matching-aggregation algorithm, where attention heads identify inference links, and the feed-forward network verifies if they form a valid chain. These findings highlight fundamental limitations in transformers’ ability to perform structured logical reasoning.
APA
Pirozelli, P. & Cozman, F.G.. (2025). A Study of Modus Ponens in Transformer Models. Proceedings of the International Conference on Neuro-symbolic Systems, in Proceedings of Machine Learning Research 288:293-315 Available from https://proceedings.mlr.press/v288/pirozelli25a.html.

Related Material