πŸͺΆ Granite Switch 4.0 350M β€” one model, many skills

One base model (ibm-granite/granite-4.0-350m) with three embedded activated-LoRA (aLoRA) adapters in a single checkpoint. A single control token switches between skills per request β€” no weight reloading. Each tab below runs your input twice: once with the adapter OFF (plain base model, rambles in prose) and once ON (the adapter's clean, structured output).
Runs fully client-side in your browser via AutoModelForCausalLM.from_pretrained on transformers.js (native granite_switch architecture), loading the ONNX model (int8 β€” first load downloads ~440 MB).
πŸ”— IBM Research blog Β· granite-switch library (GitHub) Β· model on Hugging Face

How the switch works

A LoRA adapter is a small set of low-rank weight deltas that specializes the base model for one task. Granite Switch embeds several adapters in one checkpoint and turns exactly one on per request via its control token. These are activated LoRA (aLoRA) adapters: trained so the adapter switches on at a specific point in the sequence, the chat template places that control token right before the assistant turn (<|start_of_role|>assistant<|end_of_role|>) β€” firing the switch exactly where generation begins, so the prompt is read by the base model and only the answer is generated through the adapter. (A plain LoRA would put the token at the very start and run the whole prompt through the adapter.) No adapter is loaded or swapped at runtime; the same forward pass routes through the selected adapter's deltas.

  1. You pick a tab (= an adapter) and enter input.
  2. The chat template wraps your input in the adapter's trained framing and injects its control token (e.g. <|cti-technique-mapping|>) just before the assistant turn.
  3. We run the same input twice β€” adapter OFF (plain base model) vs ON β€” so the structured lift is visible side by side.

The three skills embedded in this checkpoint:

loading model…

🟑 Base model (adapter OFF)

β€”

🟒 Granite Switch (adapter ON)

β€”