Jamba

Jamba is useful because it treats Transformer attention, Mamba-style state-space layers, and sparse MoE routing as composable architecture choices rather than mutually exclusive model families.

Metadata

FieldValue
PaperJamba: A Hybrid Transformer-Mamba Language Model
AuthorsOpher Lieber, Barak Lenz, Hofit Bata, Gal Cohen, Jhonathan Osin, Itay Dalmedigos, Erez Safahi, Shaked Meirom, Yonatan Belinkov, Shai Shalev-Shwartz, Omri Abend, Raz Alon, Tomer Asida, Amir Bergman, Roman Glozman, Michael Gokhman, Avashalom Manevich, Nir Ratner, Noam Rozen, Erez Shwartz, Mor Zusman, Yoav Shoham
Year2024
VenuearXiv preprint
arXiv2403.19887
Modelai21labs/Jamba-v0.1
Statusfull note started

Question

Decoder-only Transformers are strong language-model backbones, but long contexts expose a memory problem:

where is the number of attention layers, is context length, and is hidden size.

Mamba-style state-space models reduce the need to store every previous key/value pair:

But a pure SSM can lose some of the explicit token-token retrieval behavior that attention provides.

Jamba asks:

Main Claim

The durable architecture claim is:

This makes Jamba a hybrid architecture note, not only a model release note. Its main contribution is the composition rule:

ComponentRole
Transformer attentionexplicit content-based token-token mixing
Mamba layerefficient recurrent/state-space sequence mixing
MoE feed-forward layerlarger total parameter capacity with sparse active compute

For this wiki, Jamba belongs between Attention Is All You Need, Mamba, Mamba-2, and GLaM.

Architecture Contract

ItemContract
Inputcausal token sequence
Outputnext-token distribution
Base familydecoder-only language model
Sequence mixersinterleaved attention and Mamba layers
Capacity mechanismsparse MoE in selected feed-forward layers
Main bottleneck addressedKV-cache memory and long-context throughput
Reported implementation12B active parameters, 52B total parameters
Reported context targetup to 256K tokens

The training objective remains the ordinary autoregressive loss:

The novelty is not a new loss. It is the backbone allocation of attention, SSM, and sparse experts.

Hybrid Block View

A simplified Jamba layer stack can be read as:

where each block chooses a sequence mixer:

After the mixer, a feed-forward path may be dense or sparse:

So an abstract layer is:

This expression is intentionally generic. The paper’s key degree of freedom is how often to use attention, how often to use Mamba, and how often to replace dense FFNs with MoE.

KV Cache Pressure

Attention layers need a KV cache during autoregressive decoding:

If every layer is attention, cache memory grows with both context length and number of layers:

Hybridizing with Mamba reduces the number of attention layers that need full KV cache:

The paper reports a much smaller KV-cache footprint for Jamba than comparable attention-heavy open models at very long context. The architecture lesson is:

MoE Path

Jamba also inserts sparse MoE in some feed-forward paths. For a token representation , a router computes:

then selects top experts:

The sparse output is:

This separates total model capacity from active compute:

For Jamba, this is important because Mamba reduces long-context memory pressure while MoE increases available model capacity without activating every parameter for every token.

Why This Paper Belongs in Architecture

Jamba is not primarily a new benchmark, dataset, or training objective paper. It is an architecture composition paper.

AxisJamba’s Contribution
sequence mixinginterleaves attention and Mamba layers
memoryreduces KV cache by not making every layer attention-based
capacityuses MoE to increase total parameters with sparse activation
scaling questiontests the hybrid at large language-model scale
ablation targetattention/Mamba ratio, MoE placement, explicit positional information, Mamba stability

This makes it a good example of how paper routing should work in this blog:

Relation to Mamba and Mamba-2

Mamba asks whether selective state-space layers can compete with attention as sequence mixers.

Mamba-2 asks whether SSMs and attention can be understood through a shared structured matrix view.

Jamba asks a different practical question:

PaperArchitecture Lesson
Mambaselective SSM as an efficient sequence backbone
Mamba-2SSM/attention duality through structured matrix mixers
Jambahybrid attention-Mamba-MoE allocation at large LM scale

The distinction matters. Jamba is not evidence that pure Mamba replaces attention; it is evidence that mixed backbones are a serious design point.

Relation to MoE Scaling

Jamba inherits the sparse-capacity idea from MoE language models such as GShard, Switch Transformer, and GLaM.

The difference is the base sequence mixer:

ModelSequence BackboneSparse Capacity
Switch TransformerTransformertop-1 MoE FFN
GLaMdecoder-only Transformertop-2 MoE FFN
JambaTransformer + Mamba hybridMoE FFN in selected layers

This makes Jamba a useful bridge between conditional compute and state-space sequence modeling.

Evidence to Read Carefully

Jamba reports academic benchmark performance, long-context evaluations, throughput analysis, KV-cache comparison, and ablations.

The main evidence claims should be separated:

EvidenceSupportsDoes Not Prove Alone
benchmark scoreshybrid backbone can be competitiveuniversal superiority over dense Transformers
long-context evaluationslong-context behavior under chosen tasksrobust retrieval for every long-context workload
KV-cache comparisonattention-layer count matters for memorytotal serving cost without batch/hardware details
throughput measurementimplementation can be faster in reported settingarchitecture-only gain independent of kernel stack
MoE ablationsparse capacity helps the hybridexpert specialization or easy deployment
Mamba RMSNorm stabilizationlarge-scale Mamba layers can need internal stabilizationall SSM variants are unstable

The paper is most useful when read as a design-space map rather than a final answer.

Practical Checks

  • Count attention layers separately from total layers.
  • Track active parameters and total parameters separately.
  • Check whether MoE routing uses top-1, top-2, capacity limits, or dropped tokens.
  • Compare KV-cache memory at the same context length, dtype, hidden size, and layer count.
  • Separate long-context retrieval quality from ordinary benchmark quality.
  • Check whether positional information is explicit, implicit, or absent in each layer type.
  • Treat throughput numbers as hardware- and implementation-dependent.

Where It Fits

Jamba is a strong note for the architecture shelf because it combines three major routes:

For future notes, use Jamba as the bridge when reading:

  • hybrid Transformer-SSM language models;
  • long-context backbones with reduced KV cache;
  • sparse expert models where the base layer is not purely Transformer;
  • model-family comparisons that mix architecture, systems, and scaling claims.