Skip to content

Quantifying Logical Consistency in Transformers via Query-Key Alignment

Feb 2025 · Conference on Empirical Methods in Natural Language Processing · Vol abs/2502.17017 · 0 citations · 23 references
Computer Science Mathematics

TL;DR

This paper proposes a novel, lightweight evaluation strategy for logical reasoning that uses query-key alignments inside transformer attention heads that reveals latent representations that reliably separate valid from invalid inferences, offering a scalable alternative to traditional ablation-based techniques.

Abstract

Large language models (LLMs) have demonstrated impressive performance in various natural language processing tasks, yet their ability to perform multi-step logical reasoning remains an open challenge. Although Chain-of-Thought prompting has improved logical reasoning by enabling models to generate intermediate steps, it lacks mechanisms to assess the coherence of these logical transitions. In this paper, we propose a novel, lightweight evaluation strategy for logical reasoning that uses query-key alignments inside transformer attention heads. By computing a single forward pass and extracting a"QK-score"from carefully chosen heads, our method reveals latent representations that reliably separate valid from invalid inferences, offering a scalable alternative to traditional ablation-based techniques. We also provide an empirical validation on multiple logical reasoning benchmarks, demonstrating improved robustness of our evaluation method against distractors and increased reasoning depth. The experiments were conducted on a diverse set of models, ranging from 1.5B to 70B parameters.

View source

Similar papers

Open access Sep 2026

A Comprehensive Evaluation of Long-Context Reasoning in Transformer and State-Space LLM Architectures

A comparative study of Transformer-based and State-Space Model designs when it comes to long-context reasoning finds Transformer-based models have a pronounced tendency to forget distant information while StateSpace Model-based designs retain information more stably and yield better results for tasks that involve long...

Sheyasree Ghosh, Akanksha Srivastava, Soumen Bhowmik et al. · 0 citations
#natural language process... Conference Open access Sep 2026

When Does Reasoning Help in Machine Translation? A Hierarchical Analysis of LRM Reasoning Traces

HMS is introduced, a scalable framework that induces coarse- and fine-grained reasoning structures without predefined taxonomies and reveals a shared organization--understanding/planning, translating/drafting, and refining/verifying--alongside domain-specific variation.

Yu-Xiang Liu, Jiaming Luo, Eleftheria Briakou et al. · 0 citations
Preprint Oct 2026

Stepwise Reasoning Verification: Don't Generate, Classify!

Verifying the reasoning of large language models is increasingly important as they are applied to complex mathematical and scientific problems. Existing work focuses on large decoder models and reports mixed results for generative and discriminative verifiers, leaving unclear which paradigm is more effective and whethe...

Yi-Fei Shi, Michalis Korakakis, Rami Aly et al. · 0 citations
Preprint Oct 2026

LGMT: A Tool for Testing the Logical Reasoning Reliability of LLMs

Large Language Models (LLMs) increasingly serve as reasoning components in modern software systems, yet a model that answers a logical query correctly can contradict itself when the same problem is restated in an equivalent form. Static benchmarks evaluate queries in isolation and therefore fail to expose such inconsis...

Zeng-Hui Zhou, Xiao-Ke Fang, Zheng Zheng · 0 citations

Related blog posts

MIT News · Artificial Intelligence Nov 17, 2026

Learning the language of machine learning

By studying the computational foundations of language learning, Associate Professor Jacob Andreas builds intelligent systems that can communicate effectively with humans.

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.