Beginner1h14m

Build Long-Context AI Apps with Jamba

Instructors: Chen Wang, Chen Almagor

AI21 labs logo

Earn an accomplishment with PRO · Updated Oct 7, 2025

  • Beginner
  • 1h14m
  • 9 Video Lessons
  • 4 Code Examples
  • 1 Graded Assignment PRO
  • Earn an accomplishment with PRO
  • Updated Oct 7, 2025
  • Instructors: Chen Wang, Chen Almagor
  • AI21 labsAI21 labs
  • Learn more aboutMembership PRO Plan

What you'll learn

  • Learn how the Jamba model integrates transformers and the Mamba architecture to efficiently process long contexts while maintaining quality.

  • Understand the training process for long context models, and the metrics used to evaluate their performance.

  • Gain hands-on experience applying Jamba to tasks such as processing large documents, tool-calling, and building large context RAG apps.

Course recap

PRO

Built in partnership with AI21 Labs, this course explores the Jamba model -- a novel hybrid architecture combining traditional transformers with Mamba (state space models) to efficiently handle very long input contexts. While transformers excel at attention-based relationships but scale quadratically, Mamba offers linear-time processing but struggles with long-distance relationships. Jamba captures the best of both worlds.

Concept map

Concepts in Build Long-Context AI Apps with Jamba and the courses that connect to themBuild Long-Context AI Apps with JambaBuild Long-Context AI App…Jamba architectureAttention MechanismMamba / State Space ModelsLong context windowsContext length evaluationAttention in Transformers: Concepts and Code in PyTorchAttention in Transformers…Build and Train an LLM with JAXBuild and Train an LLM wi…Advanced Retrieval for AIConcepts in Build Long-Context AI Apps with Jamba and the courses that connect to themBuild Long-Context AI Apps with JambaBuild Long-Cont…Jamba architectureJamba architect…Attention MechanismAttention Mecha…Mamba / State Space ModelsMamba / State S…Long context windowsLong context wi…Context length evaluationContext length…

Key concepts

  • Jamba architectureHybrid transformer-Mamba model that combines attention (for long-distance relationships) with state space models (for efficiency)
  • Attention MechanismTransformer attention compares every pair of tokens but has quadratic cost in input length
  • Mamba / State Space ModelsLinear-time sequence modeling that compresses input to fixed-size representation but can lose information
  • Long context windowsExtended input capacity enabled by the hybrid architecture
  • Context length evaluationMethods for assessing model performance as context length grows

Lesson highlights

  1. 1.Introduction — Transformer limitations, Mamba, and the Jamba hybrid
  2. 2.Jamba Architecture Overview — How transformer and Mamba layers are interleaved
  3. 3.State Space Models — Mamba's selective state space mechanism
  4. 4.Context Length Strategies — Techniques for expanding model context
  5. 5.Evaluating Long Context — Benchmarks and evaluation methods
  6. 6.Prompting with Jamba — Leveraging long context for better prompts
  7. 7.Document Processing — Processing large documents with extended context
  8. 8.Tool Calling and RAG — Combining long context with retrieval and tools
  9. 9.Conclusion

About this course

Learn to use the Jamba model, a hybrid transformer-Mamba architecture trained to handle long contexts, in this new course, Build Long-Context AI Apps with Jamba, built in partnership with AI21 Labs and taught by Chen Wang and Chen Almagor.

The transformer architecture is the foundation of most large language models but it is computationally expensive when handling very long input contexts.

There’s an alternative to transformers called Mamba. Mamba is a selective state space model that can process very long contexts with a much lower computational cost. However, researchers found that the pure Mamba architecture underperforms in understanding the context, and the quality of the output can be lower even in tasks as simple as repeating the input in the output of the model.

To overcome these challenges, AI21 Labs developed the Jamba model, which combines Mamba’s computational efficiency with the transformer’s attention mechanism to help with the output quality.

In this course, you’ll learn about the Jamba architecture, how it works, and how it is trained. You’ll also learn how to prompt Jamba and use it to process long documents and build long-context RAG apps.

In detail, you’ll:

  • Learn key information about Jamba’s large context model and its unique, hybrid architecture that allows for high-quality outputs, high throughput, and low memory usage.
  • Learn how Jamba combines transformers with Mamba, a selective state-space model to achieve high performance and quality.
  • Use the AI21SDK, especially its document parameter, with an example of prompting a large over 200k-token annual report.
  • Use Jamba for tool-calling with hands-on examples from calling simple arithmetic functions to a function that returns SEC 10-Q company quarterly report.
  • Learn how the training for long context is done, and the metrics used for evaluating the performance.
  • Create a RAG app using the AI21 Conversational RAG tool and build your own RAG pipeline that uses the Jamba model with LangChain.

Start building AI apps that can handle context as long as all of your unread emails from the last 20 years!

Who should join?

Anyone who has basic Python knowledge and wants to learn more about how the Jamba model works and how it is used for building long-context AI apps.

Course Outline

9 Lessons・4 Code Examples
Unlock certificates

Elevate your learning experience with Pro

Upgrade to Pro and gain unlimited accomplishments on your resume

Learn More

Instructors

Chen Wang

Chen Wang

Lead Alliance Solution Architect at AI21 labs

Chen Almagor

Chen Almagor

Course access is free for a limited time during the DeepLearning.AI learning platform beta!

Want to learn more about Generative AI?

Keep learning with updates on curated AI news, courses, and events, as well as Andrew’s thoughts from DeepLearning.AI!