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
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.
<|cti-technique-mapping|>) just before
the assistant turn.The three skills embedded in this checkpoint:
The exact text fed to the model for the last run, after the chat template, followed by the model's completion. The adapter side injects the control token that fires the switch; the base side is the identical framing without it.
β
β