Listening to the Wise Few: Query–Key Alignment Unlocks Latent Correct Answers in Large Language Models
Eduard Tulchinskii ⋅ Kristian Kuznetsov ⋅ Laida Kushnareva ⋅ Anastasia Voznyuk ⋅ Andrei Andriiainen ⋅ Irina Piontkovskaya ⋅ Evgeny Burnaev ⋅ Serguei Barannikov
Abstract
Large language models (LLMs) routinely fail to output the correct option in multiple-choice question answering (MCQA) while encoding the answer internally. We expose this latent knowledge via the Query–Key (QK) score, defined for an attention head as the inner product between the last-token query and the key at the end-of-line token following option $i$, evaluated before rotary positional embedding is applied. Its argmax identifies a universal class of select-and-copy heads in middle layers that perform option selection through semantic query–key alignment, mechanistically distinct from induction and copy-suppression heads (Olsson et al., 2022): they are invariant to label symbols, and solve a synthetic task with zero surface overlap—properties no positional-copy account explains and that critically require stripping RoPE. Across $24$ models from $1.5\mathrm{B}$ to $72\mathrm{B}$ parameters (LLaMA-2/3/3.1/3.3, Qwen-2.5, Gemma, Phi-3.5, DeepSeek-R1-Distill), a single head's QK-score exceeds the model's own zero-shot accuracy by up to $+27.4$ pp on HellaSwag and $+49.8$ pp on HaluDialogue; causal zero-ablation collapses MCQA accuracy to near-random. To remove any dependence on labeled validation data, we introduce an unsupervised HeadScore that ranks heads from unlabeled inputs and recovers the supervised top-$k$ heads on every tested model. Against four positional-debiasing baselines (e.g., PriDe, Wiegreffe, Wang), QK-score is complementary by construction: debiasing re-weights output logits, whereas QK-score reads the model's selection from a middle-layer head before decoding. We release a one-line drop-in $\mathtt{HeadScore}$ script and per-model head indices, making every result one-command reproducible across all $24$ models and four benchmarks.
Chat is not available.
Successful Page Load