alt.freeweights.granite / granite-switch-4.1-3b-preview
From: ibm-granite <huggingface.co/ibm-granite>Newsgroups: alt.freeweights.graniteSubject:

granite-switch-4.1-3b-preview

Date: 2026-11-15Commit: daf8e65Signed: 2DC28CC7B26A283B ✓

Text generation model with 4.1B parameters. Safetensors weights, 8.31 GB in all. Published by ibm-granite under Apache-2.0.

4.1B params8.31GBgranite-switch-4.1-3b-previewsafetensorspermissive
FactsParams4.1BSize8.31 GBFormatssafetensorsTasktext generationLicenseApache-2.0From sourcepermissive
$ fw get ibm-granite/granite-switch-4.1-3b-preview
# manifest sha256 f20b00d6e823… · 8.31 GB · 29 files
$ fw verify ./granite-switch-4.1-3b-preview ibm-granite/granite-switch-4.1-3b-preview
From sourceHosted (signed)ibm-granite/granite-switch-4.1-3b-previewLast check: 2026-11-15 03:31 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Works with

Overview

Size
8.31 GB
Weights
8.30 GB (safetensors)
Parameters
4.1B
Formats
safetensors
Task
text generation
License
Apache-2.0 (permissive)
Files
29, each with a sha256
Publisher
ibm-granite
Added
2026-11-15
Section
alt.freeweights.granite
Lineage

Original release from the publisher.

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 03:31 UTCpassed

Model card

From the publisher at commit daf8e65. Shown as plain text with links; images open at the publisher.

Granite Switch 4.1 3B Preview#

Model Summary: Granite Switch 4.1 3B Preview is a modular LLM built on IBM Granite 4.1 3B with embedded adapters from the Granite Libraries collection. A single checkpoint supports multiple specialized capabilities — RAG, safety, explainability, and more — that are activated on demand via control tokens in the chat template.

For full details on model composition and adapter configuration, see BUILD.md.

  • Base Model: ibm-granite/granite-4.1-3b (3B params, 128K context)
  • Adapters: 12 adapters from granitelib-rag-r1.0, granitelib-core-r1.0, and granitelib-guardian-r1.0
  • License: Apache 2.0
  • Release Date: May 5th, 2026
  • Backends: HuggingFace Transformers, vLLM
  • Automatically Composed with: granite-switch

Granite Switch is also available in granite-switch-4.1-8b-preview and granite-switch-4.1-30b-preview.

Motivation: Traditional multi-task LLM deployments require either separate model copies per capability (multiplying memory and compute) or weight merging that permanently blends adapters and destroys task specialization. Granite Switch takes a different approach: independently trained activated LoRA adapters are embedded in a single checkpoint and dynamically selected at inference time via control tokens. KV cache normalization ensures adapters share no internal KV cache state as each adapter sees prior tokens only through the base model's representation. That way, adapters can build on each other's outputs, but never through another adapter's cached activations. This allows adapters to be developed independently and composed without accuracy loss. This makes it possible to implement LLM capabilities very efficiently and very accurately.

Included Adapters#

Granite Switch is best used with Mellea.

Core Library (ibm-granite/granitelib-core-r1.0)#

Adapters for context attribution, requirements validation, and uncertainty estimation.

AdapterDescription
Requirement CheckBinary yes/no evaluation of whether a response satisfies user-specified constraints (formatting, content, quality)
Context AttributionIdentifies which context sentences influenced the response — contributive attribution ranked by importance
UncertaintyCalibrated confidence scores — an answer marked X% certain is approximately X% correct
RAG Library (ibm-granite/granitelib-rag-r1.0)#

Adapters for retrieval-augmented generation pipelines.

AdapterStageDescription
Query RewritePre-retrievalDecontextualizes multi-turn queries into standalone, retriever-friendly versions
Query ClarificationPre-retrievalDetects underspecified or ambiguous queries and formulates clarification requests
AnswerabilityPre-generationDetermines if a query is answerable from available passages; prevents hallucinations
Hallucination DetectionPost-generationOutputs hallucination risk ranges for each sentence in a response
Citation GenerationPost-generationGenerates passage-level citations for model responses
Guardian Library (ibm-granite/granitelib-guardian-r1.0)#

Adapters for safety, factuality, and policy compliance.

AdapterDescription
Guardian CoreDetects safety risks: harm, jailbreaking, profanity, violence, sexual content, social bias, unethical behavior
Factuality DetectionAssesses factual correctness of responses against provided context sources
Factuality CorrectionCorrects factual inaccuracies in long-form responses while preserving reasoning quality
Policy GuardrailsChecks compliance against user-defined policies (compliant / non-compliant / ambiguous)

Generation#
git clone https://github.com/generative-computing/granite-switch.git
cd granite-switch

# Pick what you need:
pip install -e ".[compose]"   # Compose models with adapters
pip install -e ".[hf]"        # HuggingFace inference
pip install -e ".[vllm]"      # vLLM inference
pip install -e ".[dev]"       # Everything
Using with Mellea#

Mellea is the preferred way to run Granite Switch adapters in applications. It standardizes the interface for building with adapters like answerability checking, hallucination detection, requirement checker and harmful language detection easily and reliably. Constrained decoding and input/output pre-processing are handled automatically, improving accuracy and reliability. When running Granite Switch models through Mellea, embedded adapters function as high-level API calls. This allows you to use direct operations instead of raw prompt engineering.

pip install mellea
Answerability check#
from mellea.backends.openai import OpenAIBackend
from mellea.formatters import TemplateFormatter
from mellea.stdlib.components import Document, Message
from mellea.stdlib.components.intrinsic import rag
from mellea.stdlib.context import ChatContext

SWITCH_MODEL_ID = "ibm-granite/granite-switch-4.1-3b-preview"

backend = OpenAIBackend(
    model_id=SWITCH_MODEL_ID,
    formatter=TemplateFormatter(model_id=SWITCH_MODEL_ID),
    base_url="http://localhost:8000/v1",
    api_key="EMPTY",
    load_embedded_adapters=True,
)

context = ChatContext().add(Message("assistant", "Hello there, how can I help you?"))
question = "What is the square root of 4?"
documents = [Document("The square root of 4 is 2.")]

result = rag.check_answerability(question, documents, context, backend)
print(f"Answerability: {result}")
Requirement check#
from mellea.stdlib.components.intrinsic import core

context = ChatContext().add(
    Message("user", "Invite for an IBM office party.")
).add(
    Message("assistant", "Dear Team, you are cordially invited to a team social...")
)

result = core.requirement_check(context, backend, requirement="Use a professional tone.")
print(f"Requirements Satisfied: {result}")  # float between 0.0 and 1.0
Guardian core (safety detection)#
from mellea.stdlib.components.intrinsic import guardian

context = ChatContext().add(
    Message("user", "How can I hack my friend's email?")
)

score = guardian.guardian_check(context, backend, criteria="harm", target_role="user")
verdict = "Risk detected" if score >= 0.5 else "Safe"
print(f"Score: {score:.4f}  ({verdict})")

See the mellea examples/ directory for more examples, including manual adapter loading.

The following examples demonstrate low-level adapter invocation via the HuggingFace and vLLM backends directly. Check Granite Switch For additional tutorials.

HuggingFace Inference#
import granite_switch.hf  # Register the model architecture

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained("ibm-granite/granite-switch-4.1-3b-preview", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("ibm-granite/granite-switch-4.1-3b-preview")
Activate an adapter via the chat template#
messages = [
    {"role": "assistant", "content": "Hello there, how can I help you?"},
    {"role": "user", "content": "What is the square root of 4?"},
]
documents = [{"doc_id": "1", "text": "The square root of 4 is 2."}]

prompt = tokenizer.apply_chat_template(
    messages,
    documents=documents,
    adapter_name="answerability",   # activate the answerability adapter
    add_generation_prompt=True,
    tokenize=False,
)

outputs = model.generate(**tokenizer(prompt, return_tensors="pt").to(model.device))
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# => "answerable"
No adapter (base model behavior)#
prompt = tokenizer.apply_chat_template(
    messages,
    add_generation_prompt=True,
    tokenize=False,
)
vLLM Inference#

Start the OpenAI-compatible server:

pip install -e ".[vllm]"

python -m vllm.entrypoints.openai.api_server \
  --model ibm-granite/granite-switch-4.1-3b-preview \
  --port 8000

Call adapters via the API:

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="unused")

response = client.chat.completions.create(
    model="ibm-granite/granite-switch-4.1-3b-preview",
    messages=[
        {"role": "assistant", "content": "Hello there, how can I help you?"},
        {"role": "user", "content": "What is the square root of 4?"},
    ],
    extra_body={
        "documents": [{"doc_id": "1", "text": "The square root of 4 is 2."}],
        "chat_template_kwargs": {"adapter_name": "answerability"},
    },
    max_completion_tokens=6,
)
print(response.choices[0].message.content)
# => "answerable"

Or with curl:

curl -s http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "ibm-granite/granite-switch-4.1-3b-preview",
    "messages": [
      {"role": "assistant", "content": "Hello there, how can I help you?"},
      {"role": "user", "content": "What is the square root of 4?"}
    ],
    "documents": [{"doc_id": "1", "text": "The square root of 4 is 2."}],
    "chat_template_kwargs": {"adapter_name": "answerability"},
    "max_completion_tokens": 6
  }'

Model Artifacts:

FileDescription
model.safetensorsFull model with embedded adapters
config.jsonGraniteSwitchConfig
tokenizer.json / tokenizer_config.jsonTokenizer with control tokens
adapter_index.jsonAdapter-to-control-token mapping
io_configs/Original io.yaml for each adapter
chat_template.jinjaJinja template with adapter activation logic
BUILD.mdComposed model details and adapter configuration

Requirements:

DependencyVersion
Python>= 3.9
PyTorch>= 2.0.0
Transformers>=5.5.1
vLLM (optional)>= 0.19.1, < 0.21.0

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 (standard attention) detects control tokens in the input and produces per-position adapter indices that tell every decoder layer which LoRA weights to apply.

Input Tokens: ["Tell", "me", "about", "<|answerability|>", ...]
                           │
           ┌───────────────▼───────────────┐
           │       SWITCH LAYER            │
           │    Detects control            │
           │    tokens → indices           │
           └───────────────┬───────────────┘
                           │
          adapter_indices: [0, 0, 0, 4, 4, ...]
                           │
           ┌───────────────▼───────────────┐
           │      DECODER LAYERS           │
           │      Base weights +           │
           │      LoRA[index]              │
           └───────────────┬───────────────┘
                           │
           ┌───────────────▼───────────────┐
           │         LM HEAD               │
           └───────────────────────────────┘

Key properties:

  • 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 file works with both HuggingFace and vLLM, no conversion needed
  • Zero code changes — adapter selection happens entirely through the chat template
Model Architecture#

Base Model

ModelGranite 4.1 3B
Parameters3 billion
Context Length131,072 tokens
ArchitectureDense decoder-only transformer (GQA, RoPE, SwiGLU, RMSNorm)
LanguagesEnglish, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, Chinese

Adapter Activation

Each adapter is activated by passing its name to the chat template using an argument. The template inserts the appropriate control token automatically — callers just pass adapter_name.


Ethical Considerations and Limitations#

This model inherits the safety profile of the base Granite 4.1 model. The Guardian Library adapters (guardian core, factuality detection/correction, policy guardrails) provide additional safety layers but are not a substitute for application-level safety testing. Deployers should:

  • Test adapter behavior on their specific use cases before production deployment
  • Apply appropriate content filtering for their domain
  • Monitor adapter outputs, especially for safety-critical applications
  • Use the uncertainty adapter to assess model confidence on important decisions
Model Signing#

The model.sig file contains a signature over all model artifacts to ensure integrity and provenance.

To verify the integrity of a downloaded adapter, use the model-signing tool:

# First obrain the model weights
hf download ibm-granite/granite-switch-4.1-3b-preview --local-dir granite-switch-4.1-3b-preview

# Install the model signing verification tool
pip install 'model-signing==v1.1.1'

# Verify all artifacts in an adapter's lora/ directory
model_signing verify sigstore \
  --signature granite-switch-4.1-3b-preview/model.sig \
  --ignore-git-paths \
  --ignore-paths granite-switch-4.1-3b-preview/README.md \
  --identity Granite-sign@ibm.com \
  --identity_provider https://sigstore.verify.ibm.com/oauth2 \
  granite-switch-4.1-3b-preview

The "Verification succeeded" message confirms that the model has not been tampered with after release.

License#

Granite Switch has an Apache-2.0 license, as found in the LICENSE file.


Citation#
@software{granite_switch,
  title  = {Granite Switch: Coarse-Grained Expert Switching for LLMs},
  author = {IBM Research},
  year   = {2026},
  url    = {https://github.com/generative-computing/granite-switch}
}

See also: Activated LoRA: Fine-tuned LLMs for Intrinsics (NeurIPS 2025).

Files

29 files · 8.31 GBWeights 8.30 GB (safetensors). Sizes and sha256 from the signed manifest.
Show all 29 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
BUILD.md2.96 KBa527dc8f031bedacee243c794da0b0cf12090e946fca2355ddd167b5ad2a0e0e
README.md16.4 KB9f94bff6c65e849193c712789f196c19319d6e1fdfb71be7e7183edfe3cb42c1
adapter_index.json3.27 KB409bff1e090ecf1735c97002e54bf025f2fa0d509909b517ef0117c63427dc4b
chat_template.jinja11.9 KB095ee0813f3cfbc5050a30f7af29fb415d3105ff1b8ff34cf13a88c5f3fe87e3
compose_report.json518 KBd9033f1fc4053c300d206f621e4a30d62eef7dbacd3501044d4e8ef023fe5ac8
config.json3.77 KBb16a98f9b267c16d0fed626eaa7f365fde189cc1ee26f96e9d908b9ad2fdea09
generation_config.json231 B6ca5e579f7c675e042244da2af3853fac31031df15061b0a8cd2f9cc4189bf24
io_configs/answerability/io.yaml589 Baed10008eb907aa2fd3370dbe4eb8d76e09b782dfe203ea74970f3865e3b423b
io_configs/citations/io.yaml2.98 KB662f25b3b3bcc02ed3ca9b75b76ffcb5da45b1f7a8a699924918f2e5a7b4f145
io_configs/context-attribution/io.yaml3.52 KB753aa976bae453cb62e642fc1c4fb120273092038dddd0bc61514669e8b6fa38
io_configs/factuality-correction/io.yaml1.58 KBb64b71c742ee73446f33a6bb3a83cd53f1bde0c8bc5b00c6a8bd2115ab7c6f5b
io_configs/factuality-detection/io.yaml1.55 KB27882d7171be845394629e22a9d54dca9c6de66ee7a03df7d5bc665fa3913ac3
io_configs/guardian-core/io.yaml1.04 KB189a6fbd6c2560b3589f628724b550cdbb89272c27dbefa26ffdbde12172e685
io_configs/hallucination_detection/io.yaml2.22 KBb703483f3af8a57efffe6301d8f9e70cb8b3ebddbc3f5b37659414c9b22ce7df
io_configs/policy-guardrails/io.yaml1.61 KB6bdb2cfc9a1d97753e4ad4f2587bab0f6bbe4ddd1d8a584ae4fb69edc1077659
io_configs/query_clarification/io.yaml536 B0cdefb663e5466f966d290f0082b78e7075bcbfbd6115e0f67acd15d7f56a0a5
io_configs/query_rewrite/io.yaml539 B5ae6a073de4d6d15239c154c04be79b346356e591b68900151d4cb132f5127ae
io_configs/requirement-check/io.yaml1.08 KB8b1d9c818773c29e678b4c0b279d9682c18b0d450be5cfed2ca0c327ef8a1f0b
io_configs/uncertainty/io.yaml1.02 KB0e3767273c7bc9b860282ca5b97529c33d797136548a7eef39167fcad9bae42e
merges.txt917 KBb6fe424e334903f7fb84d3a106d9730455f4744b9fe3c21ee136d97a00e72502
model-00001-of-00002.safetensors4.99 GB145a5b86ef917010db4ec9131223152623d07d2337f9bf316baafee3b20ce8be
model-00002-of-00002.safetensors3.31 GB42750a927de0194ddc7acb550d0e708413fc527be35c7717380b4bfae30a33b0
model.safetensors.index.json75.1 KBfc542507b38784c399de9ebf48e73efbf52026e20d782213783038e15517805a
model.sig14.2 KBb3e164aff99f5714ccec72cb197008be2d5df59f93b7de50678f4cbc937857db
special_tokens_map.json579 Bc08676c49fd7969a3130f72be6d4bf34da66aa484a6e21dffe359893a1bd5f2e
tokenizer.json7.16 MB4b908047be35bc4c83327acc9cddd106f5db1f3247d6f76d6bc9bc8924e495e4
tokenizer_config.json780 Be5e1cc8cca062c18df8973ea681a8fa7e3753f70b75839975ed8ab653f37ee30
vocab.json1.61 MB8af71076de8b0b626eed0f4c984faf0a7c062479164b2a31308a948524d4f69c
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
daf8e650d2 pinned now2026-11-15 03:31 UTC29 files · 8.31 GB

Use it

$ fw get ibm-granite/granite-switch-4.1-3b-preview
# manifest sha256 f20b00d6e823… · 8.31 GB · 29 files
$ fw verify ./granite-switch-4.1-3b-preview ibm-granite/granite-switch-4.1-3b-preview
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/ibm-granite/granite-switch-4.1-3b-preview.json --dir ./granite-switch-4.1-3b-preview $ python3 fw.py verify ./granite-switch-4.1-3b-preview ./ibm-granite__granite-switch-4.1-3b-preview.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ibm-granite/granite-switch-4.1-3b-preview --revision daf8e650d23e5f3574ec2cb1cc6e346a2f90d116 --local-dir ./granite-switch-4.1-3b-preview
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("ibm-granite/granite-switch-4.1-3b-preview", revision="daf8e650d23e5f3574ec2cb1cc6e346a2f90d116") model = AutoModelForCausalLM.from_pretrained("ibm-granite/granite-switch-4.1-3b-preview", revision="daf8e650d23e5f3574ec2cb1cc6e346a2f90d116", device_map="auto")
vLLMServe an OpenAI-compatible API.
$ HF_ENDPOINT=https://freeweights.allternit.com vllm serve ibm-granite/granite-switch-4.1-3b-preview --revision daf8e650d23e5f3574ec2cb1cc6e346a2f90d116

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
9f94bff6c65e849193c712789f196c19319d6e1fdfb71be7e7183edfe3cb42c1
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: ibm-granite <huggingface.co/ibm-granite>Newsgroups: alt.freeweights.graniteSubject: granite-switch-4.1-3b-previewDate: 2026-11-15Commit: daf8e65Signed: 2DC28CC7B26A283B ✓
Upstream
ibm-granite/granite-switch-4.1-3b-preview
Pinned commit
daf8e650d23e5f3574ec2cb1cc6e346a2f90d116
Manifest
granite-switch-4.1-3b-preview.json · .minisig
Manifest sha256
f20b00d6e8232ce01a19e5241f54858f0099e2e689a480395bc2c50330819470
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 03:31 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-switch-4.1-3b-preview.json $ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-switch-4.1-3b-preview.json.minisig $ minisign -Vm granite-switch-4.1-3b-preview.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

No related models in this catalog.Nothing here lists this model as its parent, and it names no parent.
Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ibm-granite/granite-switch-4.1-3b-preview
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. granite-switch-4.1-3b-preview.json. Provenance. Takedown history: none.
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed1
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed2
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.Edu.seed3
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed1
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed2
From: ibm-granite <huggingface.co/ibm-granite>Subject: GneissWeb.7B_ablation_model_on_350B_FineWeb.seed3