CoolFace
Modelpublic

SeerAttention/SeerAttention-Llama-3.1-8B-AttnGates

sourceHugging Facellama3.1updated 2y agoView on Hugging Face
4likes186downloads
Model Card

SeerAttention-Llama-3.1-8B-AttnGates

This repo only contains the AttnGates' weights for Llama-3.1-8B-Instruct Model.

SeerAttention introduces learnable AttnGate modules to accelerate the computationally intensive prefill stage of long-context large language models (LLMs) via dynamic block-level sparsity. The AttnGates are trained in a parameter-efficient self-distillation framework, where they learn to mimic the 2D max-pooled attention patterns of the original frozen model, preserving its integrity while avoiding costly retraining. During inference, these gates generate block-sparse binary masks by applying threshold/TopK to their learned soft scores, enabling efficient computation through a custom block-sparse FlashAttention kernel.

Original Github Repo

https://github.com/microsoft/SeerAttention.

Evaluation Results

Perplexity on PG19

Density8192163843276865536131072
1.0010.039.889.929.9710.03
0.5010.049.899.929.9910.05
0.4010.069.899.939.9910.07
0.3010.099.919.9510.0110.15
0.2010.199.949.9710.0410.37
0.1010.6110.0810.0410.0910.88

LongBench

With threshold set to 2e-3.

Task0-4k4-8k8k+
2wikimqa51.147.8533.36
gov_report35.0335.0534.57
hotpotqa63.9760.056.7
lcc67.9873.1865.28
multi_news28.125.7824.25
multifieldqa_en58.6351.4551.87
passage_count18.010.1511.88
passageretrievalen100.099.098.0
qasper47.7744.0439.63
repobench-p51.7856.2456.75
samsum43.2841.1945.29
trec64.076.075.0
triviaqa90.9188.4592.43
averaged55.4354.4952.69

RULER

Dense BaselineSeerAttnAvg density
4k95.5395.530.87
8k92.2792.710.72
16k92.0192.020.56
32k87.6388.490.46
64k84.3983.480.32
128k76.2673.370.17

LongBenchV2 CoT Benchmark

All the SeerAttention models run with threshold=5e-4.

For R1-Distilled models, we remove the two passes generation setup (think + summary), we directly ask the models to output anwser after thinking. The generation max length is set to 10240.

ModelOverallEasyHardShortMediumLong
Llama-3.1-8B-Instruct30.431.229.937.824.729.6
SeerAttention-Llama-3.1-8B31.633.330.533.931.627.8
Qwen2.5-14B-Instruct34.837.533.144.432.124.1
SeerAttention-Qwen2.5-14B32.838.029.645.030.217.6
Qwen2.5-32B-Instruct)36.442.232.847.829.830.6
SeerAttention-Qwen2.5-32B36.441.133.449.429.827.8
DeepSeek-R1-Distill-Qwen-14B34.243.228.645.027.928.7
SeerAttention-DeepSeek-R1-Distill-Qwen-14B31.635.928.941.726.025.9
DeepSeek-R1-Distill-Qwen-32B37.242.733.847.235.823.1
SeerAttention-DeepSeek-R1-Distill-Qwen-32B37.042.233.849.431.626.9