Hybrid Attention and State Space Models › The Design Space

Michael BrenndoerferNovember 17, 20263 min read
Language AI HandbookAll chapters
Part 19 of 67Alternative Sequence and Generative Architectures
Chapter 134Hybrid Attention and State Space Models › The Design Space
Reading section 3 of 12 · The Design Space · 3 minSection 3 of 12 · 3 min

Section 3 of 12 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

You can set the mixer's layer count and placement and choose the feed-forward sublayer for each block. Each choice changes a different aspect of the model and can be tested with the other choices fixed.

Axis 1: the ratio

This ratio counts attention mixers against state-space mixers. A 1:7 schedule uses one attention layer per seven state-space layers. Holding total mixer depth fixed, a lower attention count reduces the number of position-indexed caches. The effects on quality depend on the models and tasks. Jamba's experiments compared 1:3 and 1:7 at one model scale.

Two cautions apply to every ratio you read:

  • The denominator matters. A 1:7 ratio counts eight sequence mixers. If all eight mixers have separate feed-forward sublayers and an author counts those sublayers too, the attention fraction is 1/161/16 of all counted sublayers rather than 1/81/8 of the mixers.
  • Ratios are scale-dependent. Compare models at the same training budget and scale before attributing a quality change to the ratio. Jamba-1.5 reports a ratio comparison and a larger single-ratio comparison separately.

Axis 2: placement

Given a fixed number of attention layers, where do they go?

  • Periodic. Place one attention layer every kk layers. Jamba places one every eight. The attention-layer indices have a regular spacing.
  • Prefix. Place attention near the beginning. The first attention layers have fewer preceding blocks to transform their inputs. Later layers still process those attention outputs.
  • Suffix. Place attention near the end. Its projections come from representations produced by more preceding blocks. The model can consult earlier positions at those late layers if their stored projections carry the relevant information.

A placement experiment needs a fixed ratio. With the same number of attention layers, you can test whether retrieval benefits from having attention earlier, later, or at several depths. The placement diagram below gives three schedules from which to construct that comparison.

Axis 3: the feed-forward sublayer

The feed-forward sublayer in the blocks described here acts at one position at a time. The sequence mixer supplies cross-position interactions. Choose a dense or expert feed-forward network separately from the choice of attention or a state-space mixer.

  • Attention with a dense feed-forward network, as in a standard Transformer.
  • State space with a dense feed-forward network, as in the Mamba layers of Jamba's ratio ablations.
  • Attention with a mixture of experts, as in a sparse Transformer.
  • State space with a mixture of experts, as in selected Jamba layers.

In the released Jamba-v0.1 schedule, the four attention layers have dense feed-forward networks. Every expert feed-forward network follows a Mamba mixer. The mixer schedule determines how many layers store attention keys and values, and expert routing determines which expert weights participate for each token. Comparing an expert hybrid with a dense attention model varies both choices. Jamba-v0.1 configuration

Active parameters

Active parameters participate in the forward pass for a token. Each routed token uses its selected experts along with the shared weights. Total parameters count all experts. Changing a mixer can also change the parameter count because attention and state-space blocks use different projections.

We will return to mixture-of-experts in Part XXXIII. The accounting examples vary mixers and leave their feed-forward costs outside the calculation.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy