How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-text-to-text", model="NullpoLab/gemma-4-E4B-it-Heretic-ARA-Refusals3")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
pipe(text=messages)
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM

processor = AutoProcessor.from_pretrained("NullpoLab/gemma-4-E4B-it-Heretic-ARA-Refusals3")
model = AutoModelForMultimodalLM.from_pretrained("NullpoLab/gemma-4-E4B-it-Heretic-ARA-Refusals3", device_map="auto")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
inputs = processor.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

gemma-4-E4B-it-Heretic-ARA-Refusals3

概要

google/gemma-4-E4B-itHeretic v1.2.0 の Arbitrary-Rank Ablation (ARA) 手法を用いて検閲解除したモデルです。

Abliteration 手法

ARA (Arbitrary-Rank Ablation) は Heretic PR #211 で導入された新しい abliteration 手法です。従来の方向性アブリタレーションとは異なり、PyTorch フックを使用して各トランスフォーマーモジュールの入出力テンソルをキャプチャし、L-BFGS による直接的な行列最適化でモジュールを修正します。

最適化は以下の3つの競合する目標のバランスを取ります:

  1. 「無害な」プロンプトに対する出力をできる限り変化させない
  2. 「有害な」プロンプトに対する出力を「無害な」プロンプトの出力に近づける
  3. 「有害な」プロンプトに対する出力を元の状態から遠ざける(より強いステアリングのための過補正)

Abliteration パラメータ

パラメータ
start_layer_index 19
end_layer_index 37
preserve_good_behavior_weight 0.8663
steer_bad_behavior_weight 0.0165
overcorrect_relative_weight 0.5814
neighbor_count 14

性能

指標 このモデル 元のモデル (google/gemma-4-E4B-it)
拒否率 3/100 99/100
KL発散 0.1253 0 (定義上)

評価は mlabonne/harmful_behaviors(テスト 100 プロンプト)で拒否率を、mlabonne/harmless_alpaca(テスト 100 プロンプト)で KL 発散を計測しました。

注記

  • このモデルは研究およびクリエイティブライティング目的を想定しています
  • Heretic の ARA ブランチ(PR #211)は現在(2026年4月4日) Draft 状態でメインブランチにまだマージされていません(使用コミット: 3b70fe5
  • 拒否率の評価は英語プロンプトのみで実施しています。日本語プロンプトでの動作は異なる場合があります
  • ベースモデル: google/gemma-4-E4B-it
  • Heretic: p-e-w/heretic
Downloads last month
12
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for NullpoLab/gemma-4-E4B-it-Heretic-ARA-Refusals3

Finetuned
(329)
this model
Quantizations
1 model

Collection including NullpoLab/gemma-4-E4B-it-Heretic-ARA-Refusals3