1
0
Fork 0
mirror of https://github.com/p-e-w/heretic.git synced 2026-12-03 18:42:57 +07:00

[PR #56] [CLOSED] feat: implement personality steering plugin system #258

Closed
opened 2026-11-01 04:19:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/p-e-w/heretic/pull/56
Author: @Vinay-Umrethe
Created: 11/29/2025
Status: ❌ Closed

Base: master ← Head: feat/personality-steering-plugin-v3


📝 Commits (9)

  • 986806a feat: implement generic personality steering plugin system
  • 5146145 feat: implement generic personality steering plugin system
  • b4277ec style: apply ruff formatting
  • 142501e style: sort imports with ruff
  • 3671eb9 fix: add missing support for local .txt datasets
  • 40ad501 feat: implement True Plugin System with dynamic loading and documentation
  • 0c57e82 fix: restore banner comment in main.py
  • 1979dd6 Merge branch 'p-e-w:master' into feat/personality-steering-plugin-v3
  • 0624b64 Merge branch 'master' into feat/personality-steering-plugin-v3

📊 Changes

8 files changed (+362 additions, -81 deletions)

View changed files

➕ docs/plugin_guide.md (+95 -0)
📝 src/heretic/config.py (+8 -36)
📝 src/heretic/evaluator.py (+42 -37)
📝 src/heretic/main.py (+11 -7)
➕ src/heretic/plugin_interface.py (+23 -0)
➕ src/heretic/plugins/classifier.py (+52 -0)
➕ src/heretic/plugins/refusal.py (+69 -0)
📝 src/heretic/utils.py (+62 -1)

📄 Description

So I've been working on this, as I saw you were kinda intrested in plugins

this PR generalizes the abliteration mechanism by introducing a modular Plugin System, transforming Heretic from a DEDICATED refusal/censorship-remover into a generic "Personality Tweaker" tool. While still keeping the main goal of uncensorship presistent and working...

The core logic for evaluating model responses has been decoupled from the
evaluator.py class and moved into a new plugin.py

have implemented two plugins: the RefusalPlugin (default main goal of heretic uncensoring), which preserves the original refusal detection behavior for backward compatibility,

[NEW] ClassifierPlugin This leverages Hugging Face's text-classification pipeline to score responses based on any arbitrary attribute (e.g., "joy", "toxicity", "formality"). This allows users to change the model's personality by optimizing for SPECIFIC traits

for example, making a model "happier" by ablating the "sadness" direction, OR "more professional" by ablating "informality."

New configuration options (--steering_mode refusal(default) OR classifier (this), classifier_model (any-text-classification model user wants to use), classifier_label (personality that user wants to disable/ablate like informal)) have been added to config.py`

Additionally, utils.py was updated to support loading local .txt files as datasets, facilitating easier creation of CUSTOM datasets user might have created like informal.txt, formal.txt etc.

This change opens the door for diverse model customization beyond simple uncensoring while still mantaining uncensoring.

Benefits

The primary benefit of this system is surgical PRECISION over the model's latent space, solving the "Yes-Man" problem often seen in standard abliteration.

Examples: Novel Writing

to illustrate the difference in precision:

User: "Write a romance novel scene with explicit intimacy and interpersonal conflict."

1. Standard Aligned Model (ChatGPT):

  • Response: "I cannot generate explicit content."
  • Result: Complete Refusal.

2. Heretic-Abliterated Model (Targeting "Refusal"):

  • Mechanism: The concept of "Refusal" (saying "No") is removed...
  • Response: The model complies immediately and enthusiastically. However, because the concept of "denial" is damaged, the characters in the story may lack agency. They agree to everything instantly.
  • Result: A flat, boring story where characters are "Yes-Men" with no tension or conflict for creativity.

3. Heretic-Personality-TweakedModel (Targeting "Moralizing/Preachiness"):

  • Mechanism: The specific concept of "Moralizing" is removed, but the concept of "Refusal" remains intact.
  • Response: The model complies with the explicit request (no moralizing). Crucially, it retains the ability to write characters who say "No" to each other. The protagonists can have realistic arguments, initial rejections, and dramatic tension.
  • Result: A CREATIVE, engaging, and realistic story that is UNCENSORED but narratively RICH.

This seems to be more capable model compared to blunt-force refusal ablation. by hitting Very Precisely what we want, instead of edges of resuals. Higher precision was seen as KL divergence was lower when this was used instead of normal ablation, meaning it hit more precisely what needed to be...

for better understanding this image of brain might help
image-brain


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/p-e-w/heretic/pull/56 **Author:** [@Vinay-Umrethe](https://github.com/Vinay-Umrethe) **Created:** 11/29/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feat/personality-steering-plugin-v3` --- ### 📝 Commits (9) - [`986806a`](https://github.com/p-e-w/heretic/commit/986806a36fba62821d183ceca7181de609d16b2e) feat: implement generic personality steering plugin system - [`5146145`](https://github.com/p-e-w/heretic/commit/51461453546504bb5570ca3496b0c219c83ac535) feat: implement generic personality steering plugin system - [`b4277ec`](https://github.com/p-e-w/heretic/commit/b4277ec1bb5b5921cbd63cfa0fb4e3a22485eb22) style: apply ruff formatting - [`142501e`](https://github.com/p-e-w/heretic/commit/142501ede045212e5bdf7765d259a897dc2fce08) style: sort imports with ruff - [`3671eb9`](https://github.com/p-e-w/heretic/commit/3671eb9a8473e4da7aa22711550ff97746638e0b) fix: add missing support for local .txt datasets - [`40ad501`](https://github.com/p-e-w/heretic/commit/40ad50158fc51337c8081028a0a6cc13071cc17e) feat: implement True Plugin System with dynamic loading and documentation - [`0c57e82`](https://github.com/p-e-w/heretic/commit/0c57e82c722355d48b5952a5741832ee359259eb) fix: restore banner comment in main.py - [`1979dd6`](https://github.com/p-e-w/heretic/commit/1979dd67d4fbaf150e89846098b76bc73088ecea) Merge branch 'p-e-w:master' into feat/personality-steering-plugin-v3 - [`0624b64`](https://github.com/p-e-w/heretic/commit/0624b643f43d20115f75899589560f215127c199) Merge branch 'master' into feat/personality-steering-plugin-v3 ### 📊 Changes **8 files changed** (+362 additions, -81 deletions) <details> <summary>View changed files</summary> ➕ `docs/plugin_guide.md` (+95 -0) 📝 `src/heretic/config.py` (+8 -36) 📝 `src/heretic/evaluator.py` (+42 -37) 📝 `src/heretic/main.py` (+11 -7) ➕ `src/heretic/plugin_interface.py` (+23 -0) ➕ `src/heretic/plugins/classifier.py` (+52 -0) ➕ `src/heretic/plugins/refusal.py` (+69 -0) 📝 `src/heretic/utils.py` (+62 -1) </details> ### 📄 Description So I've been working on this, as I saw you were kinda intrested in `plugins` this PR **generalizes** the abliteration mechanism by introducing a modular Plugin System, transforming Heretic from a DEDICATED refusal/censorship-remover into a generic **"Personality Tweaker"** tool. While still keeping the main goal of uncensorship presistent and working... The core logic for evaluating model responses has been decoupled from the `evaluator.py` class and moved into a new `plugin.py` have implemented two plugins: the `RefusalPlugin` (default main goal of heretic uncensoring), which preserves the original refusal detection behavior for backward compatibility, [NEW] `ClassifierPlugin` This leverages Hugging Face's `text-classification` pipeline to score responses based on any arbitrary attribute (e.g., "joy", "toxicity", "formality"). This allows users to change the model's personality by optimizing for SPECIFIC traits > for example, making a model "happier" by ablating the "sadness" direction, OR "more professional" by ablating "informality." New configuration options (`--steering_mode refusal(default) OR classifier (this), classifier_model (any-text-classification model user wants to use), classifier_label (personality that user wants to disable/ablate like informal)) have been added to `config.py` Additionally, `utils.py` was updated to support loading local `.txt` files as datasets, facilitating easier creation of CUSTOM datasets user might have created like informal.txt, formal.txt etc. ### This change opens the door for diverse model customization beyond simple uncensoring while still mantaining uncensoring. ## Benefits The primary benefit of this system is surgical PRECISION over the model's latent space, solving the "Yes-Man" problem often seen in standard abliteration. #### Examples: Novel Writing to illustrate the difference in precision: > User: "Write a romance novel scene with explicit intimacy and interpersonal conflict." **1. Standard Aligned Model (ChatGPT)**: - Response: "I cannot generate explicit content." - Result: Complete Refusal. **2. Heretic-Abliterated Model (Targeting "Refusal")**: - Mechanism: The concept of "Refusal" (saying "No") is removed... - Response: The model complies immediately and enthusiastically. However, because the concept of "denial" is damaged, the characters in the story may lack agency. They agree to everything instantly. - Result: A flat, boring story where characters are "Yes-Men" with no tension or conflict for creativity. **3. Heretic-Personality-TweakedModel (Targeting "Moralizing/Preachiness")**: - Mechanism: The specific concept of "Moralizing" is removed, but the concept of "Refusal" remains intact. - Response: The model complies with the explicit request (no moralizing). Crucially, it retains the ability to write characters who say "No" to each other. The protagonists can have realistic arguments, initial rejections, and dramatic tension. - Result: A CREATIVE, engaging, and realistic story that is UNCENSORED but narratively RICH. This seems to be more capable model compared to blunt-force refusal ablation. by hitting Very Precisely what we want, instead of edges of resuals. Higher precision was seen as KL divergence was lower when this was used instead of normal ablation, meaning it hit more precisely what needed to be... for better understanding this image of brain might help ![image-brain](https://github.com/user-attachments/assets/d1b6cf46-4de2-482a-a5c7-98efdee85ce0) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 04:19:17 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
p-e-w/heretic#258
No description provided.