Logicbreaks: A Framework for Understanding Subversion of Rule-based Inference
Anton Xue, Avishree Khare, Rajeev Alur, Surbhi Goel, Eric Wong
TL;DR
This paper introduces a logic-based framework to study subversion of rule-following in LLMs by modeling rule-following as propositional Horn entailment and defining MMS (Monotone, Maximal, Sound). It shows an equivalence to Horn-SAT, constructs a theoretically exact reasoner using attention-based encodings, and derives theory-driven attacks that transfer to learned models. Empirical experiments on Minecraft crafting tasks with GPT-2 and Llama families reveal that suffix-based jailbreaks align with the theory and produce characteristic attention patterns. The results provide a formal foundation for analyzing jailbreaks and rule-based reasoning in LLMs and highlight directions for stronger safeguards and future expressivity in logical inference.
Abstract
We study how to subvert large language models (LLMs) from following prompt-specified rules. We first formalize rule-following as inference in propositional Horn logic, a mathematical system in which rules have the form "if $P$ and $Q$, then $R$" for some propositions $P$, $Q$, and $R$. Next, we prove that although small transformers can faithfully follow such rules, maliciously crafted prompts can still mislead both theoretical constructions and models learned from data. Furthermore, we demonstrate that popular attack algorithms on LLMs find adversarial prompts and induce attention patterns that align with our theory. Our novel logic-based framework provides a foundation for studying LLMs in rule-based settings, enabling a formal analysis of tasks like logical reasoning and jailbreak attacks.
