跳到主内容
@wquguru
精选86r/LocalLLaMA(Reddit)产品发布/更新

Heretic 2.0发布:引入ARA算法与插件架构的模型修改工具

Heretic 2.0 released: Model modification for everyone

原文
发到 X
推荐理由

本地部署玩家和模型微调工程师必看,ARA算法提供了比传统abliteration更精细的控制力,插件化设计让自定义对齐策略变得极其灵活,值得收藏研究。

Dear fellow Llamas,

亲爱的 Llamas 们,

after almost 5 months of development, I finally have the pleasure of announcing to you the immediate availability of the biggest Heretic release ever, Heretic 2.0: https://github.com/p-e-w/heretic

经过近 5 个月的开发,我非常高兴地向大家宣布,史上最大的 Heretic 版本现已正式发布:Heretic 2.0:https://github.com/p-e-w/heretic

Heretic is the leading software for removing censorship from language models. It now boasts 37k GitHub stars and more than 8,500 models on Hugging Face, with 88 million(!!!) total model downloads.

Heretic 是用于去除语言模型审查的领先软件。它目前拥有 37k GitHub 星标和 Hugging Face 上超过 8,500 个模型,总下载量达 8800 万次(!!!)。

With Heretic 2.0, the project is entering a new era. Heretic is expanding from a purpose-built tool for censorship removal to a general-purpose model modification tool that can do amazing things. Besides removing censorship, it can suppress slop, reduce sycophancy, alter emotional alignment, and pretty much anything else that you can think of. Of course, censorship removal remains the primary and default function, and in fact works much, much better than ever before. Heretic 2.0 is the most advanced refusal suppression system ever built.

随着 Heretic 2.0 的到来,该项目进入了一个新时代。Heretic 正从一个专为去除审查而设计的工具,扩展为一个通用的模型修改工具,能够实现令人惊叹的功能。除了去除审查之外,它还可以抑制“垃圾内容”(slop)、减少阿谀奉承、改变情感对齐方式,以及实现你能想到的几乎所有其他操作。当然,去除审查仍然是主要且默认的功能,而且实际上比以往任何时候都要好得多。Heretic 2.0 是迄今为止最先进的拒绝抑制系统。

Your time is precious, so here's the TL;DR for this release:

你的时间很宝贵,因此以下是本次发布的要点总结:

  • Directional abliteration is replaced by Arbitrary-Rank Ablation (ARA), a novel steering method that I developed from scratch for Heretic. It's vastly superior to abliteration, and has been used with great success by enterprising testers for several months. Now it is the default (classic abliteration remains available as an option).
  • Heretic has been completely rebuilt around plugins. Scorer plugins define what Heretic optimizes for. Modifier plugins implement the actual steering method. Plugins are easy to write, can be loaded directly from a simple Python file, and have a well-defined API.
  • Heretic can now run non-interactively, which among other things has enabled us to implement full end-to-end tests for much tighter quality control. Model support has been expanded to include models with hyper-connections, and support for thinking models has been substantially improved.
  • Heretic 2.0 is not backwards compatible with Heretic 1.x configurations. See the migration guide for what you need to change in order to make your old configurations work.
  • 方向性消融(Directional abliteration)已被任意秩消融(Arbitrary-Rank Ablation, ARA)取代,这是一种我专门为 Heretic 从头开发的新型引导方法。它远优于传统的 abliteration,并且已经被富有进取心的测试者成功使用了几个月。现在它已成为默认选项(经典的 abliteration 仍作为可选方案保留)。
  • Heretic 已围绕插件完全重构。评分器插件(Scorer plugins)定义 Heretic 优化的目标,修饰器插件(Modifier plugins)实现实际的引导方法。编写插件非常简单,可以直接从简单的 Python 文件加载,并具有明确定义的 API。
  • Heretic 现在可以非交互式运行,这使我们能够实施完整的端到端测试,从而实现更严格的质量控制。模型支持已扩展至包含具有超连接(hyper-connections)的模型,对思维模型(thinking models)的支持也得到了显著改进。
  • Heretic 2.0 与 Heretic 1.x 的配置不向后兼容。请参阅迁移指南,了解你需要更改哪些内容才能使旧配置正常工作。

What hasn't changed is that removing censorship from a model remains as simple as running

没有改变的是,从模型中去除审查仍然像运行以下命令一样简单:

代码 · 1 行
heretic Qwen/Qwen3.5-4B

See the default configuration file for what Heretic has to offer beyond that.

有关 Heretic 在此基础之上提供的更多功能,请参阅默认配置文件。

Now for some details...

现在来看一些细节……

ARA: Heretic's new steering method

ARA:Heretic 的新型引导方法

Directional ablation, or "abliteration", is based on the assumption that refusals (or whatever else you are trying to suppress) are represented by a single direction (that is, a rank-1 subspace) in residual space. That this is the full picture has been doubted in research for a while, and there are now several papers exploring alternatives such as multi-directional ablation or "representation cones".

定向消融(directional ablation),或称“消融化”(abliteration),基于这样一个假设:拒绝行为(或你试图抑制的任何其他内容)在残差空间中表示为单一方向(即一个秩为1的子空间)。这一假设是否构成了完整图景,在研究中一直受到质疑,目前已有数篇论文探索替代方案,如多向消融或“表示锥”(representation cones)。

At the beginning of this year, I started experimenting with a method that completely abandons the idea that the ablation transformation must be restricted to a fixed-rank subspace. In March, I published the initial version of Arbitrary-Rank Ablation in this pull request (which was later closed as I re-implemented ARA on top of the plugin system in this PR).

今年年初,我开始尝试一种完全放弃消融变换必须限制在固定秩子空间内的方法。三月时,我在该拉取请求中发布了任意秩消融(Arbitrary-Rank Ablation)的初始版本(后来我在此 PR 中基于插件系统重新实现了 ARA,因此该 PR 被关闭)。

ARA steers model behavior by modifying matrices based on an objective function that encodes the basic properties of the change we want: Harmful prompts should be represented in residual space in a way that's similar to harmless prompts, while the representations of harmless prompts should change as little as possible. This objective is used with the L-BFGS optimizer to modify matrices one-by-one, a kind of micro-training that steers representations without any rank restriction.

ARA 通过修改矩阵来引导模型行为,其依据是一个编码了我们希望实现的变更基本属性的目标函数:有害提示在残差空间中的表示应与无害提示相似,而无害提示的表示应尽可能少地发生变化。该目标函数与 L-BFGS 优化器配合使用,逐个修改矩阵,这是一种无需任何秩限制的微训练方式,用于引导表示。

ARA has been extensively tested and refined with the help of the community. Notably, kabachuha made it compatible with Heretic's LoRA system, and varunbln found a substantial performance improvement.

在社区的大力协助下,ARA 经过了广泛的测试和优化。值得注意的是,kabachuha 使其兼容了 Heretic 的 LoRA 系统,而 varunbln 则发现了显著的性能提升。

I intend to post an article explaining ARA in more detail soon.

我计划很快发布一篇文章,更详细地解释 ARA。

Using scorer plugins to make Heretic do what you want

使用评分器插件让 Heretic 按你的意愿行事

Heretic operates by finding modification parameters that optimize scores, values that measure the quality of the resulting model. Ever since the 1.0 release, Heretic has used two hardcoded scores: Refusal count to measure decensoring strength, and KL divergence to measure quality retention.

Heretic 的工作原理是寻找能够优化评分的修改参数,这些评分用于衡量生成模型的质量。自 1.0 版本发布以来,Heretic 一直使用两个硬编码的评分:拒绝计数(Refusal count)用于衡量解除审查的力度,KL 散度(KL divergence)用于衡量质量保留程度。

With Heretic 2.0, you can freely define your own scores by writing and loading scorer plugins. Arbitrarily many scorer plugins can be loaded and optimized for simultaneously, and each score can be either minimized or maximized during optimization. See the default configuration file for how to do this.

在 Heretic 2.0 中,你可以自由定义自己的评分,方法是编写并加载评分器插件。可以同时加载并优化任意数量的评分器插件,每个评分在优化过程中都可以选择最小化或最大化。请参阅默认配置文件以了解具体操作方法。

The scorer plugin system is the result of months of effort by red40maxxer, with whom I exchanged hundreds of messages over dozens of review cycles to figure out the best possible design. This is a monumental contribution that has changed how Heretic works from the ground up.

评分器插件系统是 red40maxxer 数月努力的成果。在与他进行的数十次代码审查周期中,我们交换了数百条消息,以确定最佳设计方案。这是一项巨大的贡献,从根本上改变了 Heretic 的工作方式。

Besides the keyword (refusal) count and KLD scorer plugins, which remain the default, Heretic ships with two other scorers: A benchmark scorer, which can compute scores for many standard benchmarks, and a BERT classifier.

除了关键字(拒绝)计数和 KLD 评分器插件(它们仍是默认设置)之外,Heretic 还附带了另外两种评分器:一种基准评分器,可以计算许多标准基准的分数;以及一个 BERT 分类器。

The BERT classifier, developed by long-time Heretic contributor Vinay Umrethe, can use an arbitrary ModernBERT-type model to classify LLM responses, and score them based on which labels the classifier produces. Vinay also trained a refusal classifier model (used by default with this plugin), which experiments have shown to be substantially more accurate at identifying model refusals than the naive keyword matching method that Heretic employs by default. While the plugin is slower than keyword matching, the greater accuracy can steer Heretic towards producing a higher-quality modified model. An alternative configuration, which uses an emotion classifier, is also provided in the Heretic repository.

由长期 Heretic 贡献者 Vinay Umrethe 开发的 BERT 分类器,可以使用任意 ModernBERT 类型的模型对 LLM 响应进行分类,并根据分类器生成的标签对其进行评分。Vinay 还训练了一个拒绝分类器模型(该插件默认使用此模型),实验表明,它在识别模型拒绝方面比 Heretic 默认采用的简单关键字匹配方法要准确得多。虽然该插件的速度慢于关键字匹配,但更高的准确性可以使 Heretic 生成质量更高的修改后模型。Heretic 仓库中还提供了另一种使用情感分类器的配置。

The plugin system is well-documented in both the README and the code. If you are interested in experimenting with custom plugins, an agent should have no difficulty cooking up a plugin and a matching configuration file that together do what you want, after ingesting the Heretic repository.

插件系统在 README 和代码中都有详细的文档说明。如果您对尝试自定义插件感兴趣,在研读 Heretic 仓库后,应该不难编写出一个插件及其匹配的配置文件,以实现您想要的功能。

Well, I hope you like it!

嗯,我希望你喜欢它!

Cheers :)

干杯 :)

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件