HyperAIHyperAI

Command Palette

Search for a command to run...

MiniMax Attention Éparse

Résumé

La capacité de traitement de contextes ultra-longues devient indispensable pour les LLM de pointe : les workflows agentic, le raisonnement sur le code à l'échelle des dépôts et la mémoire persistante exigent tous que le modèle porte conjointement son attention sur des centaines de milliers à des millions de tokens, alors que le coût quadratique de l'attention softmax rend cette approche irréaliste à l'échelle du déploiement. Nous présentons MiniMax Sparse Attention (MSA), une attention sparse par blocs reposant sur l'attention à requêtes groupées (Grouped Query Attention, GQA). Une branche d'indexation légère attribue un score aux blocs clé-valeur et sélectionne indépendamment un sous-ensemble Top-k pour chaque groupe GQA, permettant une récupération sparse spécifique au groupe tout en conservant une exécution efficace au niveau des blocs ; la branche principale effectue ensuite une attention block-sparse exacte sur les seuls blocs sélectionnés. Conçu selon un principe de simplicité et de scalabilité, MSA est délibérément allégé, ce qui en facilite le déploiement efficace sur une large gamme de GPU. Afin de convertir la sparsité en accélérations pratiques, nous co-concevons MSA avec un chemin d'exécution GPU exploitant une sélection Top-k sans fonction exponentielle et une attention KV-outer sparse afin d'améliorer l'utilisation des tensor-cores lors d'un accès à granularité de bloc. Sur un modèle de 109 milliards de paramètres entraîné de manière native sur des données multimodales, MSA obtient des performances équivalentes à celles de GQA tout en réduisant le calcul d'attention par token de 28.4x à un contexte de 1M. Couplé à notre kernel co-conçu, MSA offre des accélérations de 14.2x pour le prefill et de 7.6x pour le decoding en temps réel sur H800. Notre kernel d'inférence est disponible à l'adresse suivante : https://github.com/MiniMax-AI/MSA. Un modèle multimodal natif de qualité production, alimenté par MSA, a été publiquement mis à disposition à l'adresse suivante : https://huggingface.co/MiniMaxAI/MiniMax-M3.

One-sentence Summary

MiniMax Sparse Attention (MSA) is a Grouped Query Attention variant that employs a lightweight Index Branch to independently select Top-k key-value blocks per group, enabling exact block-sparse computation that matches standard performance while reducing per-token compute by 28.4x at one million tokens and delivering 14.2x prefill and 7.6x decoding speedups on H800 GPUs through a co-designed kernel leveraging exp-free Top-k selection and KV-outer sparse attention.

Key Contributions

  • MiniMax Sparse Attention (MSA) is a blockwise sparse attention mechanism built on Grouped Query Attention that employs a lightweight index branch to independently score and select a top-k subset of key-value blocks for each GQA group prior to exact block-sparse attention.
  • A co-designed GPU execution path implements exp-free top-k selection and KV-outer sparse attention to maximize tensor-core utilization under block-granular memory access patterns.
  • Evaluations on a 109B-parameter multimodal model demonstrate that the approach maintains performance parity with standard Grouped Query Attention while reducing per-token attention compute by 28.4x at a one-million-token context, yielding 14.2x prefill and 7.6x decoding wall-clock speedups on H800 hardware.

Introduction

Long-context modeling in transformer-based language models requires efficient attention mechanisms to mitigate the quadratic computational and memory overhead of dense softmax attention. Prior approaches typically substitute attention with linear or recurrent alternatives, apply fixed content-agnostic sparse patterns, or implement adaptive sparsification that either inherits full-attention training costs or suffers from fragmented memory access and unoptimized inference kernels. The authors leverage a per-GQA-group Top-k sharing strategy combined with block-level selection to preserve contiguous KV cache reads while maintaining adaptive context awareness. They further accelerate the framework by adapting the FlashAttention algorithmic skeleton with loop ordering specifically tuned to this access pattern, effectively translating theoretical FLOP reductions into measurable wall-clock speedups.

Experiment

Two 109B-scale experiments validate replacing dense attention with a sparse mechanism by either training from scratch or continuing pretraining from a full-attention checkpoint. The native sparse approach demonstrates that the model can stably adapt its representations to learn essential attention structures without hard-coded constraints, while the continued pretraining route validates a practical and stable conversion pathway from dense checkpoints. Both methods maintain competitive performance across language, multimodal, and long-context benchmarks despite a strict key-value token budget. Ultimately, the sparse architecture delivers substantial computational efficiency and sustained long-context capabilities, establishing it as a scalable alternative to dense attention.


Créer de l'IA avec l'IA

De l'idée au lancement — accélérez votre développement IA avec le co-codage IA gratuit, un environnement prêt à l'emploi et le meilleur prix pour les GPU.

Codage assisté par IA
GPU prêts à l’emploi
Tarifs les plus avantageux

HyperAI Newsletters

Abonnez-vous à nos dernières mises à jour
Nous vous enverrons les dernières mises à jour de la semaine dans votre boîte de réception à neuf heures chaque lundi matin
Propulsé par MailChimp