10 4 days ago

tools 8b 30b
ollama run mrutkows/granite4.1-switch:30b-q5_K_M

Details

4 days ago

0244d579d5d9 · 24GB

graniteswitch
·
30.6B
·
Q5_K_M
{{- /* Go equivalent of the Granite Switch chat_template.jinja (see chat_template.jinja) for the bas
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR US

Readme

Granite Switch 4.1 models

📝 Read the launch blog: Granite Switch 4.1.1: Update models like you update software

Granite Switch 4.1.1 is a modular LLM that composes a base model, multiple adapters and an encoder together so that a single hosted endpoint can move between natural-language responses, general and specialized decisions, and speech-to-text. Adapters are activated on demand via control tokens in the chat template.

Granite Switch 4.1.1 is available in two sizes:

  • 8B: ibm/granite4.1-switch:8b
  • 30B: ibm/granite4.1-switch:30b (128K context)

Both sizes embed the same components:

  • Adapters: 2 — decision (aLoRA, general-purpose Decisions) and guardian-core (aLoRA, from granitelib-guardian-r1.0)
  • Audio: embedded speech-to-text via ibm-granite/granite-speech-5.0-470m-turboctc (English, French, German, Spanish, Portuguese, Italian, Japanese)

Running Granite Switch in Ollama

Capabilities & Ollama Limitations

Granite Switch GGUFs unify four distinct capabilities in a single model file: 1. Base Language Model: Open-ended conversational generation, instruction following, and reasoning. 2. Decision aLoRA Adapter: Softmax probability classification over arbitrary questions, choices, or ranked levels. 3. Guardian Core aLoRA Adapter: Safety moderation across harm, bias, profanity, and unethical prompts. 4. Speech-to-Text Audio Encoder: Multilingual ASR (granite-speech-5.0-470m-turboctc) for direct voice transcription.

Current Ollama Runtime Limitations: - Decision Mode Only: Ollama identifies graniteswitch architecture metadata as a Decision Model (Capability: decision). In Ollama, the model exclusively executes the decision evaluation pipeline via the --ask flag. - No Open-Ended Chat in Ollama: Ollama’s /api/chat and /api/generate endpoints reject graniteswitch models (does not support chat / generate). - No Audio Ingestion in Ollama: Ollama does not pass audio waveform inputs or inject adapter control tokens (adapter_name="speech"), so the embedded audio encoder cannot be invoked via ollama run.

Decision Mode Examples
1. Yes/No Decisions

Pass the context text via standard input and ask a binary question:

echo "The sky appears blue because molecules in Earth's atmosphere scatter sunlight in all directions. Blue light is scattered more than other colors because it travels as shorter, smaller waves." | ollama run mrutkows/granite4.1-switch:8b-q4_K_M --ask "Does the atmosphere scatter blue light?"

Output:

yes  100%
2. Multiple-Choice Decisions (--choice)

Classify context across multiple defined choices:

echo "The sky appears blue because molecules in Earth's atmosphere scatter sunlight in all directions. Red and yellow wavelengths pass straight through." | ollama run mrutkows/granite4.1-switch:8b-q4_K_M --ask "Which color is scattered most?" --choice blue="Blue light" --choice red="Red light" --choice yellow="Yellow light"

Output:

blue  100%
3. Interactive Multi-Input Classification Session

Start an interactive decision session without piping input, then submit multiple prompts sequentially:

ollama run mrutkows/granite4.1-switch:8b-q4_K_M \
  --ask "What color is this fruit?" \
  --choice red="Red" \
  --choice yellow="Yellow" \
  --choice orange="Orange" \
  --choice green="Green"

Interactive Session Example:

>>> A ripe banana
yellow  95%

>>> A fresh juicy strawberry
red  100%

>>> A sweet juicy tangerine
orange  89%

>>> A crisp Granny Smith apple
green  97%

Alternative Ways to Run Granite Switch as an LLM

To use Granite Switch beyond Ollama’s decision mode — including full conversational generation, dynamic aLoRA adapter routing (decision, guardian-core), and multimodal speech-to-text — download the standalone GGUF files directly from Hugging Face or serve the model with vLLM / Transformers:

Included Adapters & Encoders

Switch Component Description
Guardian Core aLoRA Detects safety risks: harm, jailbreaking, profanity, violence, sexual content, social bias, unethical behavior
Decision aLoRA Given a state + a question with labelled options, returns a softmax probability distribution over the option labels in one forward pass
Granite Speech 5.0 TurboCTC Encoder A multilingual ASR model for fast speech-to-text transcription

How It Works

Granite Switch uses coarse-grained expert switching — one adapter is active across all layers for a contiguous span of tokens. A lightweight switch layer detects control tokens in the input and produces per-position adapter indices that tell every decoder layer which LoRA weights to apply.

  • KV cache normalization — each adapter sees only the base model’s KV cache, never another adapter’s internal state
  • No joint training — adapters are developed, tested, and published independently
  • Single checkpoint — one model contains the base weights and all adapters

Supported Languages

English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese (inherited from Granite 4.1). Speech input supports English, French, German, Spanish, Portuguese, Italian and Japanese.

Ethical Considerations and Limitations

This model inherits the safety profile of the base Granite 4.1 model. The embedded guardian-core adapter provides an additional safety layer but is not a substitute for application-level safety testing. Deployers should test adapter behavior on their specific use cases, apply appropriate content filtering for their domain, and treat the decision adapter’s option probabilities as a prior to inform a decision, not a certified classification, on domains it wasn’t trained for.


Learn more