What problem does it solve? Understanding how large language models process contextual versus parametric knowledge requires inspecting internal attention states, which is difficult without dedicated tooling. This Skill provides scripts to extract Q/K/V attention matrices, identify massive values in low-frequency dimensions, and measure how disrupting them affects model performance on knowledge tasks. ## Core Features & Use Cases - Attention Extraction & Visualization: Hook into transformer layers of models like Llama, Mistral, Qwen, and Gemma to capture Q/K/V states and generate attention heatmaps. - Massive Value Identification: Detect outlier activations via percentile thresholds and analyze their frequency distribution with FFT. - Disruption Experiments: Replace massive values with mean, zero, or random values and measure accuracy drops on contextual knowledge QA and passkey retrieval tasks. - Use Case: A researcher investigating RoPE's role in contextual knowledge understanding runs a disruption experiment on Llama-2-7b, observing that zeroing top outliers in query matrices at layers 1, 2, and 10 degrades QA accuracy, confirming the ICML 2025 paper's findings. ## Quick Start Run the attention analysis script on a HuggingFace model with a sample prompt to extract Q/K/V states and visualize massive values across specified layers.