Zubnet AIAprenderWiki › Mamba
Models

Mamba

Mamba Architecture
Uma arquitetura selective state space model (SSM) projetada como alternativa ao Transformer. Criada por Albert Gu e Tri Dao, Mamba alcança desempenho competitivo de modelagem de linguagem com scaling linear em comprimento de sequência (vs. o custo quadrático de atenção do Transformer). Processa sequências mantendo um estado oculto comprimido que é atualizado seletivamente — informação importante é preservada, informação irrelevante decai.

Por que importa

Mamba representa o desafio mais credível à dominância do Transformer. Se ela (ou seus descendentes) cumprir a promessa de processamento de sequências em tempo linear com resultados de qualidade Transformer, as implicações são enormes: janelas de contexto muito mais longas, inferência mais rápida, custos mais baixos. A parte “selective” é chave — diferente de SSMs anteriores, Mamba faz suas transições de estado dependentes da entrada, o que lhe dá a expressividade para igualar atenção.

Deep Dive

Classical state space models maintain a fixed-size hidden state that gets updated at each timestep via learned matrices A (state transition), B (input projection), and C (output projection). Mamba's innovation is making B and C input-dependent — the model learns to selectively focus on or ignore different parts of the input based on content, not just position. This selectivity is what earlier SSMs lacked and what prevented them from matching Transformer performance on language tasks.

The Hardware Story

Mamba's other contribution is a hardware-aware implementation. The selective scan operation is rewritten to minimize memory transfers between GPU HBM and SRAM, using kernel fusion and recomputation to avoid materializing the full state expansion in memory. This engineering makes the theoretical linear complexity translate to actual wall-clock speedups, not just asymptotic improvements that get eaten by constant factors.

Mamba-2 and Hybrids

Mamba-2 simplified the architecture by showing that the selective state space model can be viewed as a structured form of attention, unifying the SSM and Transformer perspectives mathematically. This led to hybrid architectures (like Jamba from AI21, Zamba from Zyphra) that interleave Mamba layers with attention layers, getting the efficiency of SSMs for most of the sequence processing while using attention for the tasks where global token interaction is essential. The debate isn't "SSM vs. Transformer" anymore — it's about finding the optimal mix.

Conceitos relacionados

← Todos os termos
← Machine Aprendering Masked Language Modeling →