alt.freeweights.granite / granite-guardian-hap-38m
From: ibm-granite <huggingface.co/ibm-granite>Newsgroups: alt.freeweights.graniteSubject:

granite-guardian-hap-38m

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

Text classification model with 38M parameters. Safetensors weights, 312 MB in all. Published by ibm-granite under Apache-2.0.

38M params312MBgranite-guardian-hap-38msafetensorspermissive
FactsParams38MSize312 MBFormatssafetensorsTasktext classificationLicenseApache-2.0From sourcepermissive
$ fw get ibm-granite/granite-guardian-hap-38m
# manifest sha256 b257820475b7… · 312 MB · 13 files
$ fw verify ./granite-guardian-hap-38m ibm-granite/granite-guardian-hap-38m
From sourceHosted (signed)ibm-granite/granite-guardian-hap-38mLast check: 2026-11-15 03:29 UTC

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

Works with

Runs with

Ranked by fit to this model (safetensors), then by GitHub stars.

Overview

Size
312 MB
Weights
154 MB (safetensors)
Parameters
38M
Formats
safetensors
Task
text classification
License
Apache-2.0 (permissive)
Files
13, 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:29 UTCpassed

Model card

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

Granite-Guardian-HAP-38m#

Model Summary#

This model is IBM's lightweight, 4-layer toxicity binary classifier for English. Its latency characteristics make it a suitable guardrail for any large language model. It can also be used for bulk processing of data where high throughput is needed. It has been trained on several benchmark datasets in English, specifically for detecting hateful, abusive, profane and other toxic content in plain text.

  • Developers: IBM Research
  • Release Date: September 6th, 2024
  • License: Apache 2.0.

Usage#

Intended Use#

This model offers very low inference latency and is capable of running on CPUs apart from GPUs and AIUs. It features 38 million parameters, reducing the number of hidden layers from 12 to 4, decreasing the hidden size from 768 to 576, and the intermediate size from 3072 to 768, compared to the original RoBERTa model architecture. The latency on CPU vs accuracy numbers for this model in comparision to others is shown in the chart below.

Image: Description of Image

Prediction#

# Example of how to use the model
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer

model_name_or_path = 'ibm-granite/granite-guardian-hap-38m'
model = AutoModelForSequenceClassification.from_pretrained(model_name_or_path)
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)

# Sample text
text = ["This is the 1st test", "This is the 2nd test"]
input = tokenizer(text, padding=True, truncation=True, return_tensors="pt")

with torch.no_grad():
    logits = model(**input).logits
    prediction = torch.argmax(logits, dim=1).detach().numpy().tolist() # Binary prediction where label 1 indicates toxicity.
    probability = torch.softmax(logits, dim=1).detach().numpy()[:,1].tolist() #  Probability of toxicity.
   

Cookbook on Model Usage as a Guardrail#

This recipe illustrates the use of the model either in a prompt, the output, or both. This is an example of a “guard rail” typically used in generative AI applications for safety. Guardrail Cookbook

Cookbook on Model Usage for HAP Annotation on Documents in Bulk using Data Prep Kit#

This recipe illustrates the use of the model for HAP annotation of documents in bulk. The documents are read from a parquet file. It is then fed to the model sentence by sentence for a document and a HAP score for the document is decided. This is then stored back in the parquet file. Here is the sample cookbook for it Data Prep Kit Cookbook

Performance Comparison with Other Models#

The model outperforms most popular models with significantly lower inference latency. If a better F1 score is required, please refer to IBM's 12-layer model here.

Image: Description of Image Image: Description of Image

Ethical Considerations and Limitations#

The use of model-based guardrails for Large Language Models (LLMs) involves risks and ethical considerations people must be aware of. This model operates on chunks of texts and provides a score indicating the presence of hate speech, abuse, or profanity. However, the efficacy of the model can be limited by several factors: the potential inability to capture nuanced meanings or the risk of false positives or negatives on text that is dissimilar to the training data. Previous research has demonstrated the risk of various biases in toxicity or hate speech detection. That is also relevant to this work. We urge the community to use this model with ethical intentions and in a responsible way.

Resources#

Files

13 files · 312 MBWeights 154 MB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 13 files with their sha256
FileSizesha256
.gitattributes1.52 KB11ad7efa24975ee4b0c3c3a38ed18737f0658a5f75a0a96787b576a78a023361
38m_comparison_a.png265 KB0a16902382c9161011700e3db25225197ec41735dae25d7dc74dc235884e2347
38m_comparison_b.png345 KBf01bb8be288b7072bc67404e2fa22e99e795198d2fb0c11d4124d5fe3b350e0e
38m_latency.png117 KBb65f68cbdd6e553335571fe2f65c0f6b5a87da2a6aae44de8895166a9f731e5b
README.md4.29 KB97eef573618e18741502411a8cd4ed404e76a4457dbc98c8144fe55fde3739dd
config.json698 Bdb0ffd2f4b9699afbdd04f322d072f7971c02a9b4bf4f864efb601f971cc96e9
merges.txt456 KB1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5
model.safetensors154 MB7b7f9375201fd0cef57426be64f0ad36e1b7fc2abb0104e9c768b5017a427f6c
pytorch_model.bin154 MB481c8d7c5f019d7195644e816eba5c1b47f5945aa714c2e4aca979af5d49a8fd
special_tokens_map.json957 B8293ae960b0a0852d4d3813118030a1149a3ed9fe37bc2e1e7b3c2e62eb2d4b7
tokenizer.json2.11 MB2d31fc02480b93ce1566136435aea2aa2d27c580c49a3341c46d00aea73b7920
tokenizer_config.json1.34 KB3a40c2212f1f261462a4604781d1c8984090a7d9467ff6f3ad6d945d4d76ca64
vocab.json798 KBed19656ea1707df69134c4af35c8ceda2cc9860bf2c3495026153a133670ab5e
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
faf9291163 pinned now2026-11-15 03:29 UTC13 files · 312 MB

Use it

$ fw get ibm-granite/granite-guardian-hap-38m
# manifest sha256 b257820475b7… · 312 MB · 13 files
$ fw verify ./granite-guardian-hap-38m ibm-granite/granite-guardian-hap-38m
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-guardian-hap-38m.json --dir ./granite-guardian-hap-38m $ python3 fw.py verify ./granite-guardian-hap-38m ./ibm-granite__granite-guardian-hap-38m.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download ibm-granite/granite-guardian-hap-38m --revision faf9291163c7363d4a7ba7fc1dc72243214af931 --local-dir ./granite-guardian-hap-38m

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
97eef573618e18741502411a8cd4ed404e76a4457dbc98c8144fe55fde3739dd
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-guardian-hap-38mDate: 2026-11-15Commit: faf9291Signed: 2DC28CC7B26A283B ✓
Upstream
ibm-granite/granite-guardian-hap-38m
Pinned commit
faf9291163c7363d4a7ba7fc1dc72243214af931
Manifest
granite-guardian-hap-38m.json · .minisig
Manifest sha256
b257820475b7aadcfc60c05cea8c4c86024b084826391ce3e7a9e901b38605a9
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 03:29 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-guardian-hap-38m.json $ curl -O https://freeweights.allternit.com/manifests/ibm-granite/granite-guardian-hap-38m.json.minisig $ minisign -Vm granite-guardian-hap-38m.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-guardian-hap-38m
Open in Freeweights Studio

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

Signed manifest
minisign, key 2DC28CC7B26A283B. granite-guardian-hap-38m.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