[ICLR 2025] SEKA: Steering LLM Attention via Spectral Key Editing

Spectral Attention Steering for Prompt Highlighting

Summary
Problem
Method
Results
Takeaways
Abstract

The paper introduces Spectral Editing Key Amplification (SEKA) and its adaptive variant, AdaSEKA, for prompt highlighting and attention steering in LLMs. By modifying key embeddings using spectral decomposition (SVD), it achieves SOTA results on knowledge conflict and instruction-following tasks while maintaining full compatibility with FlashAttention.

TL;DR

Researchers from the University of Edinburgh and their collaborators have introduced Spectral Editing Key Amplification (SEKA). Unlike previous methods that "hack" the attention matrix after it's built, SEKA edits the key embeddings before the attention score is even calculated. This simple shift makes it incredibly fast, memory-efficient, and—crucially—compatible with FlashAttention.

Contextual Position: This work moves away from post-hoc attention manipulation (like PASTA) toward pre-attention representation engineering, effectively bridging the gap between "Activation Steering" and "Attention Control."

The Bottleneck: Why "Post-Hoc" Doesn't Scale

In the quest to make Large Language Models (LLMs) follow specific parts of a prompt (Prompt Highlighting), current SOTA methods like PASTA operate by scaling the attention scores. However, at a PhD level, we recognize a fundamental engineering conflict here: Modern LLM efficiency relies on FlashAttention, which fuses the attention kernel to avoid materializing the full matrix in the GPU's High Bandwidth Memory (HBM).

If you want to edit the attention scores, you must materialize that matrix, destroying the memory benefits and introducing massive latency. The authors found that PASTA increases inference time by over 1 second per sample—a non-starter for production.

The Insight: Relevance in the Key Subspace

The authors hypothesized that "relevance" is not just a score, but a direction in the latent space of Key () vectors. By analyzing contrastive prompts (Relevant vs. Irrelevant query for the same context), they visualized a consistent directional shift in certain attention heads.

Key Embedding Shifts Figure: Visualizing the structured shift in Key embeddings when token relevance changes.

The Methodology: SEKA & AdaSEKA

  1. Spectral Decomposition (SVD): SEKA performs SVD on the cross-covariance matrices of key embeddings to identify the "relevance subspace."
  2. Key Amplification: During inference, the key for a highlighted token is transformed as: Where is the projection matrix derived from the top singular vectors. This effectively boosts the signal of the highlighted token in the directions the model uses for retrieval.
  3. AdaSEKA (Query-Adaptive): Not all prompts are the same. AdaSEKA uses a "routing" mechanism to blend different expert projections (e.g., one expert for factual recall, another for instructions) by measuring how well the current Query () aligns with each expert's subspace.

SEKA Architecture

Experimental Breakthroughs

The performance metrics are striking, particularly in tasks involving In-Context Knowledge Conflict (CounterFact) and Instruction Following (Pronoun Changing).

1. Inverting the "Lost-in-the-Middle" Curve

Standard LLMs suffer from a U-shaped performance curve, forgetting information in the middle of long contexts. By applying SEKA specifically to the middle passages, the authors managed to invert the curve, turning the performance trough into a peak.

U-Shape Inversion

2. Efficiency Benchmark

SEKA achieves its gains with near-zero cost. While PASTA adds 23 GB of peak memory overhead and +1.03s latency, SEKA stays within 0.03 GB and +0.03s of the original model.

MethodLatency OverheadMemory Overhead
Original0.55s27.63 GB
PASTA+1.03s+23.12 GB
SEKA+0.03s+0.03 GB

Critical Perspective & Takeaway

Why it works: From a mechanistic interpretability standpoint, SEKA targets the "Routing Subspace" (Q/K interaction) while leaving the "Semantic Subspace" (Value/MLP) untouched. This surgical precision avoids the "collateral damage" common in logit-based or full-activation steering.

Limitations: The method still requires a "selection" of sensitive KV heads. While the authors provide a threshold-based heuristic (), the optimal heads vary between model families (e.g., Qwen vs. Gemma), suggesting that the "retrieval circuit" is architecture-dependent.

Conclusion: SEKA proves that we don't need to rebuild or even fully see the attention matrix to control it. By understanding the geometry of the Key space, we can steer LLMs at the speed of FlashAttention.

Find Similar Papers

Try Our Examples

  • Search for recent papers published after 2024 that propose training-free attention steering or prompt highlighting techniques compatible with IO-aware attention implementations like FlashAttention-3.
  • Which original research first established the "relevance subspace" or "steering vector" concept in Transformer key-query interactions, and how does SEKA's spectral decomposition approach differ from traditional activation addition (ActAdd)?
  • Explore studies that apply spectral editing or key-space manipulation to multi-modal Transformer models (e.g., Vision-Language Models) for grounding or object-centric attention steering tasks.
Contents
[ICLR 2025] SEKA: Steering LLM Attention via Spectral Key Editing
1. TL;DR
2. The Bottleneck: Why "Post-Hoc" Doesn't Scale
3. The Insight: Relevance in the Key Subspace
3.1. The Methodology: SEKA & AdaSEKA
4. Experimental Breakthroughs
4.1. 1. Inverting the "Lost-in-the-Middle" Curve
4.2. 2. Efficiency Benchmark
5. Critical Perspective & Takeaway