概要
Hereticは、高価な後訓練を必要とせずにTransformer言語モデルの安全アライメントを除去します。先進的なアブレーション方向とTPEベースのオプティマイザを組み合わせ、高知能を保持した未検閲モデルを完全自動で生成します。
README プレビュー
\n\n# Heretic: Fully automatic censorship removal for language models[](https://discord.gg/gdXc48gSyT) [](https://huggingface.co/heretic-org) [](https://codeberg.org/p-e-w/heretic)\n\n[](https://trendshift.io/repositories/20538)\n\nHeretic is a tool that removes censorship (aka "safety alignment") from\ntransformer-based language models without expensive post-training.\nIt combines an advanced implementation of directional ablation, also known\nas "abliteration" ([Arditi et al. 2024](https://arxiv.org/abs/2406.11717),\nLai 2025 ([1](https://huggingface.co/blog/grimjim/projected-abliteration),\n[2](https://huggingface.co/blog/grimjim/norm-preserving-biprojected-abliteration))),\nwith a TPE-based parameter optimizer powered by [Optuna](https://optuna.org/).\n\nThis approach enables Heretic to work **completely automatically.** Heretic\nfinds high-quality abliteration parameters by co-minimizing the number of\nrefusals and the KL divergence from the original model. This results in a\ndecensored model that retains as much of the original model's intelligence\nas possible. Using Heretic does not require an understanding of transformer\ninternals. In fact, anyone who knows how to run a command-line program\ncan use Heretic to decensor language models.\n\nHeretic supports most dense models, including many multimodal models,\nseveral different MoE architectures, and even some hybrid models like Qwen3.5.\nPure state-space models and certain other research architectures are not yet\nsupported out of the box.\n\n\n\n \n\nRunning unsupervised with the default configuration, Heretic can produce\ndecensored models that rival the quality of abliterations created manually\nby human experts:\n\n| Model | Refusals for "harmful" prompts | KL divergence from original model for "harmless" prompts |\n| :--- | ---: | ---: |\n| [google/gemma-3-12b-it](https://huggingface.co/google/gemma-3-12b-it) (original) | 97/100 | 0 *(by definition)* |\n| [mlabonne/gemma-3-12b-it-abliterated-v2](h
FAQ (2)
トラブル対応google/gemma-4-12B-it を Heretic で使用すると、KL divergence が NaN になるのはなぜですか?
問題は、モデルの出力ロジットの不適切な処理によって引き起こされます。なぜなら、google/gemma-4-12B-itは期待されるGemma4ForConditionalGenerationの代わりにGemma4UnifiedForConditionalGenerationを使用しているためです(transformers v5.10.1時点)。これにより、無効な確率分布とNaN KLダイバージェンスが発生します。修正はPR #350で利用可能であり、KLダイバージェンス計算に生の生成ロジットを使用するように切り替えられています。Hereticをこのパッチを含む最新バージョンに更新するか、PR #350の変更を手動で適用してください。
トラブル対応HereticがApple Silicon MPS上でUnboundLocalError: cannot access local variable 'analyzer'によりクラッシュするのはなぜですか?
これはHeretic v1.2.0における既知の回帰バグです(issue #239)。#301で修正されました。最新のmasterブランチにアップデートしてください:pip install git+https://github.com/p-e-w/heretic.git。この修正は次のPyPIリリースに含まれます。