arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2502.17017cs.CLcs.AIcs.ITcs.LGmath.ITmath.LO
收藏

量化Transformer中查询-键对齐的逻辑一致性

Quantifying Logical Consistency in Transformers via Query-Key Alignment

Skolkovo Institute of Science and Technology(斯科尔科沃科学技术研究所);Moscow Institute of Physics and Technology(莫斯科物理技术学院);CNRS(法国国家科学研究中心);Université Paris Cité(巴黎西岱大学);Artificial Intelligence Research Institute (AIRI)(人工智能研究所(AIRI))

Eduard Tulchinskii, Anastasia Voznyuk, Laida Kushnareva, Andrei Andriiainen, Irina Piontkovskaya, Evgeny Burnaev, Serguei Barannikov

AI总结:

本文提出一种轻量级逻辑推理评估方法,通过Transformer注意力头中的查询-键对齐计算QK分数,无需额外训练即可区分有效与无效推理,并在多基准上验证了其鲁棒性和可扩展性。

摘要:

大型语言模型(LLMs)在各种自然语言处理任务中展现了令人印象深刻的性能,然而它们执行多步逻辑推理的能力仍然是一个未解决的挑战。尽管思维链(Chain-of-Thought)提示通过使模型生成中间步骤改进了逻辑推理,但它缺乏评估这些逻辑转换连贯性的机制。在本文中,我们提出了一种新颖的、轻量级的逻辑推理评估策略,该策略利用Transformer注意力头内部的查询-键对齐。通过计算单次前向传播并从精心选择的头中提取“QK分数”,我们的方法揭示了能够可靠地区分有效与无效推理的潜在表示,为传统的基于消融的技术提供了一种可扩展的替代方案。我们还在多个逻辑推理基准上进行了实证验证,证明了我们的评估方法在对抗干扰项和增加推理深度方面具有更好的鲁棒性。实验在从1.5B到70B参数的一系列不同模型上进行。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑