Can Transformers Reason Logically? A Study in SAT Solving

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Pan, Leyan, Ganesh, Vijay, Abernethy, Jacob, Esposo, Chris, Lee, Wenke
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866916603953676288
author Pan, Leyan
Ganesh, Vijay
Abernethy, Jacob
Esposo, Chris
Lee, Wenke
author_facet Pan, Leyan
Ganesh, Vijay
Abernethy, Jacob
Esposo, Chris
Lee, Wenke
contents We formally study the logical reasoning capabilities of decoder-only Transformers in the context of the boolean satisfiability (SAT) problem. First, we prove by construction that decoder-only Transformers can decide 3-SAT, in a non-uniform model of computation, using backtracking and deduction via Chain-of-Thought (CoT). %We prove its correctness by showing trace equivalence to the well-known DPLL SAT-solving algorithm. Second, we implement our construction as a PyTorch model with a tool (PARAT) that we designed to empirically demonstrate its correctness and investigate its properties. Third, rather than \textit{programming} a transformer to reason, we evaluate empirically whether it can be \textit{trained} to do so by learning directly from algorithmic traces (``reasoning paths'') from our theoretical construction. The trained models demonstrate strong out-of-distribution generalization on problem sizes seen during training but has limited length generalization, which is consistent with the implications of our theoretical result
format Preprint
id arxiv_https___arxiv_org_abs_2410_07432
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Can Transformers Reason Logically? A Study in SAT Solving
Pan, Leyan
Ganesh, Vijay
Abernethy, Jacob
Esposo, Chris
Lee, Wenke
Machine Learning
Artificial Intelligence
Logic in Computer Science
We formally study the logical reasoning capabilities of decoder-only Transformers in the context of the boolean satisfiability (SAT) problem. First, we prove by construction that decoder-only Transformers can decide 3-SAT, in a non-uniform model of computation, using backtracking and deduction via Chain-of-Thought (CoT). %We prove its correctness by showing trace equivalence to the well-known DPLL SAT-solving algorithm. Second, we implement our construction as a PyTorch model with a tool (PARAT) that we designed to empirically demonstrate its correctness and investigate its properties. Third, rather than \textit{programming} a transformer to reason, we evaluate empirically whether it can be \textit{trained} to do so by learning directly from algorithmic traces (``reasoning paths'') from our theoretical construction. The trained models demonstrate strong out-of-distribution generalization on problem sizes seen during training but has limited length generalization, which is consistent with the implications of our theoretical result
title Can Transformers Reason Logically? A Study in SAT Solving
topic Machine Learning
Artificial Intelligence
Logic in Computer Science
url https://arxiv.org/abs/2410.07432