Skip to main content

Overview

The Jamba models can be fine-tuned using several approaches:
  • Full Fine-tuning: Complete model parameter updates (requires significant GPU resources)
  • LoRA (Low-Rank Adaptation): Parameter-efficient fine-tuning approach
  • QLoRA: Combines LoRA with 4-bit quantization for single GPU training

Full Fine-tuning

Full fine-tuning updates all model parameters and provides the most comprehensive training results. For a comprehensive implementation guide using AWS SageMaker with multi-node and FSDP configuration, see the AI21 SageMaker Fine-tuning Repository.
Full fine-tuning requires multiple high-memory GPUs.

LoRA Fine-tuning

LoRA (Low-Rank Adaptation) fine-tuning injects compact, low-rank adapter layers into a frozen pretrained model—letting you specialize it for your task with just a few percent of the parameters, minimal extra compute and storage and with a small loss in accuracy or inference speed.

Prerequisites

Before starting LoRA fine-tuning, install the required dependencies:
This LoRA fine-tuning example uses bfloat16 precision and requires ~130GB GPU RAM (e.g., 2x A100 80GB GPUs).

Implementation

1

Load Model and Tokenizer

2

Configure LoRA Parameters

3

Prepare Your Dataset

4

Configure Training Settings

5

Initialize and Start Training

The dataset in this example uses conversational format (with messages column), so SFTTrainer automatically applies Jamba’s chat template. For more information about supported dataset formats and advanced SFTTrainer features, see the TRL documentation.

QLoRA Fine-tuning

QLoRA combines LoRA with 4-bit quantization, making it possible to fine-tune on a single 80GB GPU while maintaining good performance.

Prerequisites

Before starting QLoRA fine-tuning, install the required dependencies:

Implementation

1

Initialize Tokenizer and Configure Quantization

2

Load Model with Quantization

3

Configure LoRA Parameters

4

Prepare Your Dataset

5

Configure Training Settings

6

Initialize and Start Training