错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Efficient Sparse Attention: Temperature-Scaled Sampling for Enhanced Inference

  • Xiangyu Hu,
  • Lin Lu

摘要

As transformer-based language models grow in size and complexity, efficient attention mechanisms have become critical for practical deployment in resource-constrained and latency-sensitive applications. Traditional attention mechanisms suffer from quadratic complexity in both computation and memory usage with respect to sequence length, creating significant inference bottlenecks. We propose Temperature-Scaled Sparse Attention (TSSA), which combines temperature-scaled softmax with adaptive top-k sparsification to enhance inference efficiency while preserving model quality. TSSA sharpens attention distributions through a temperature parameter, then dynamically selects only the most salient attention weights based on context. Through rigorous evaluation across multiple datasets and model configurations, we demonstrate that TSSA achieves a 2.12 \(\times \) speedup in inference throughput with negligible impact on generation quality (0.08% increase in validation loss). Our method reduces memory bandwidth requirements by up to 69.6% and scales efficiently with increasing sequence length. TSSA requires minimal implementation changes to existing transformer architectures and can be readily integrated into production deployment pipelines.