mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[PR #60] [MERGED] feat: Add 4-bit loading + LoRA support for low VRAM optimization #260
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#260
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/p-e-w/heretic/pull/60
Author: @accemlcc
Created: 12/1/2025
Status: ✅ Merged
Merged: 12/14/2025
Merged by: @p-e-w
Base:
master← Head:master📝 Commits (10+)
c7a952dAdd files via upload5e65ab1perf: optimize abliteration matrix op (#46)3cacbaeFix line endings to LF8f1fafdResolve merge conflict by keeping LoRA implementationcc06d27Add hybrid approach for GPT-OSS compatibilityc6bc76dMerge upstream/master - keep hybrid approach5657491Fix projector bug, update print statement, revert README86b8852Revert README changes to match upstream529a91aFix import sorting for ruffbdd3f57Fix reload_model for evaluate_model, add type hints and validation📊 Changes
7 files changed (+2387 additions, -1511 deletions)
View changed files
➕
.gitattributes(+1 -0)📝
config.default.toml(+4 -0)📝
pyproject.toml(+2 -0)📝
src/heretic/config.py(+11 -0)📝
src/heretic/main.py(+109 -13)📝
src/heretic/model.py(+243 -54)📝
uv.lock(+2017 -1444)📄 Description
Hi! As discussed on Reddit, this PR implements a workflow to enable abliteration on consumer hardware with limited VRAM.
Changes:
bitsandbytes.Impact:
Let me know if you need any changes!
PLEASE NOTE PEW's Technical Implementation Note:
Just for posterity, the "LoRA" approach in this implementation is a bit of a different beast from how LoRAs are normally used.
The idea behind a low-rank adaptation is to factor the adapter matrix (which is simply added to the module matrix) into a product of two low-rank matrices. This drastically decreases the number of trainable parameters, allowing for more efficient training.
But we don't do training here. In fact, we already pre-decide what the matrix product BA should be, from the abliteration parameters alone.
In principle, that makes PEFT overkill for this task, as we could simply use a basic module wrapper that applies the adapter in the forward pass. I've thought about this because I dislike unnecessary dependencies, but the reason PEFT still makes sense is that it is designed to work with Transformers, and saves us a lot of manual messing around with weights. Therefore, I believe that this PR is correct in using PEFT, despite the approach being somewhat unconventional for LoRA adapters.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.