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

granite-switch-4.1-8b-preview

Date: 2026-11-15Commit: 8a22410Signed: 2DC28CC7B26A283B ✓

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

9.6B params19.1GBgranite-switch-4.1-8b-previewsafetensorspermissive
FactsParams9.6BSize19.1 GBFormatssafetensorsTasktext generationLicenseApache-2.0From sourcepermissive
$ fw get ibm-granite/granite-switch-4.1-8b-preview
# manifest sha256 d4f8854ebf4b… · 19.1 GB · 31 files
$ fw verify ./granite-switch-4.1-8b-preview ibm-granite/granite-switch-4.1-8b-preview
From sourceHosted (signed)ibm-granite/granite-switch-4.1-8b-previewLast check: 2026-11-15 03:47 UTC

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

Works with

Overview

Size
19.1 GB
Weights
19.1 GB (safetensors)
Parameters
9.6B
Formats
safetensors
Task
text generation
License
Apache-2.0 (permissive)
Files
31, 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:47 UTCpassed

Model card

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

Granite Switch 4.1 8B Preview#

Model Summary: Granite Switch 4.1 8B Preview is a modular LLM built on IBM Granite 4.1 8B 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-8b (8B 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-3b-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-8b-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-8b-preview", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("ibm-granite/granite-switch-4.1-8b-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-8b-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-8b-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-8b-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 8B
Parameters8 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-8b-preview --local-dir granite-switch-4.1-8b-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-8b-preview/model.sig \
  --ignore-git-paths \
  --ignore-paths granite-switch-4.1-8b-preview/README.md \
  --identity Granite-sign@ibm.com \
  --identity_provider https://sigstore.verify.ibm.com/oauth2 \
  granite-switch-4.1-8b-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

31 files · 19.1 GBWeights 19.1 GB (safetensors). Sizes and sha256 from the signed manifest.
Show all 31 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
BUILD.md2.99 KB33ac1335b789685925bc9a2e9c4cafac83d87fea42b25f9f787830d236c6c71e
README.md16.4 KB508d55e4c617e2e1aa1c715c10805d2ff27d2f03effb6f560f0807109b93c16b
adapter_index.json3.27 KBe9cb5e1120bd3151a7b806fa12ac40ad753d46d29cca9f1a0b87816a253a41b1
chat_template.jinja11.9 KB095ee0813f3cfbc5050a30f7af29fb415d3105ff1b8ff34cf13a88c5f3fe87e3
compose_report.json538 KBf3d1f0b94110f513568749b8035f6b5bfd46484352829b1dff9a0ffc0eba0bc5
config.json3.77 KBfca08de8daa5fb0c5544881fd566e79a16f0f7bfdd1df3cc2baa9264caaf105a
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.65 KB0b21490f6ef1edc2d56e2a1bd5df50ac7cbf296f759f0de0c4a0b5d39ffd1550
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-00004.safetensors5.00 GBef835d0ce92ba66677700c9702b15616749b74922d3fcf2b37b4eb0291695947
model-00002-of-00004.safetensors4.98 GB06644fb2f44e8b96391b0fc9d5b27c627969d76efe162767d523b484d94e828b
model-00003-of-00004.safetensors4.93 GBe1737eafaa33ae8a48beb7f825f00c6695c777cc8a79d9b2713dbcb346ee31db
model-00004-of-00004.safetensors4.23 GB02509078c508b0f7db3780eb4bf62cec6a962d402fd3b956809bf1f158f2f862
model.safetensors.index.json75.1 KB3f07be759313238a10174398f8e18749eee34d4b88cd472ae506af3e407127a6
model.sig14.6 KBcae292d71673b115fbe25edb964daded5ef79585b9af7af936dc603e37189ee1
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
8a22410af7 pinned now2026-11-15 03:47 UTC31 files · 19.1 GB

Use it

$ fw get ibm-granite/granite-switch-4.1-8b-preview
# manifest sha256 d4f8854ebf4b… · 19.1 GB · 31 files
$ fw verify ./granite-switch-4.1-8b-preview ibm-granite/granite-switch-4.1-8b-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-8b-preview.json --dir ./granite-switch-4.1-8b-preview $ python3 fw.py verify ./granite-switch-4.1-8b-preview ./ibm-granite__granite-switch-4.1-8b-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-8b-preview --revision 8a22410af7cbbfa2cbbd39a3af281ba98c2df846 --local-dir ./granite-switch-4.1-8b-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-8b-preview", revision="8a22410af7cbbfa2cbbd39a3af281ba98c2df846") model = AutoModelForCausalLM.from_pretrained("ibm-granite/granite-switch-4.1-8b-preview", revision="8a22410af7cbbfa2cbbd39a3af281ba98c2df846", device_map="auto")
vLLMServe an OpenAI-compatible API.
$ HF_ENDPOINT=https://freeweights.allternit.com vllm serve ibm-granite/granite-switch-4.1-8b-preview --revision 8a22410af7cbbfa2cbbd39a3af281ba98c2df846

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
508d55e4c617e2e1aa1c715c10805d2ff27d2f03effb6f560f0807109b93c16b
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-8b-previewDate: 2026-11-15Commit: 8a22410Signed: 2DC28CC7B26A283B ✓
Upstream
ibm-granite/granite-switch-4.1-8b-preview
Pinned commit
8a22410af7cbbfa2cbbd39a3af281ba98c2df846
Manifest
granite-switch-4.1-8b-preview.json · .minisig
Manifest sha256
d4f8854ebf4b9c9f74ca494214778f6e22b2d2eb5ba4a0caf4fb368038ec18f6
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 03:47 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-8b-preview.json $ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-switch-4.1-8b-preview.json.minisig $ minisign -Vm granite-switch-4.1-8b-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-8b-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-8b-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