Sponsored by
Crazyrouter
-The enterprise-grade, cost-effective AI API gateway that provides one API key to access 300+ AI models through OpenAI-compatible endpoints, with
This is
Phi4 abliterated
using a new methodology (surprisingly?). The approach is still being refined, with a focus on balancing neutrality, usability, and adaptability for fine-tuning.
Goal
The objective is to create a model that is
neutral
:
Not uncensored
, but avoids refusing neutral prompts it would ordinarily reject.
Provides a foundation for fine-tuning to achieve reduced censorship while maintaining high usability.
Original Methodology
In the original implementation:
Harmful and harmless prompts were compared on
one specific layer
of the model.
The computed refusal direction was then applied
uniformly to all layers
.
Problem:
This resulted in:
A model that became
less usable
and
less intelligent
than the original.
This may be because applying a single refusal direction uniformly across all layers disregards the unique role of each layer in the model.
By applying refusal directions individually to each layer's tensors:
The model can retain more
specificity and functionality
.
This avoids over-generalizing the refusal direction across all layers, which previously led to reduced usability.
Trade-offs:
The more we force refusal directions onto the model:
The more
neutral
it becomes, but at the risk of becoming
dumber
.
This underscores the importance of
fine-tuning
after abliterating, to restore functionality and intelligence.
So despite the script letting the user choose a
scale factor
, too high value will break the model.
Next Steps
The abliterated model serves as a
neutral starting point
. Fine-tuning is essential to:
Adjust the model to reduce over-censoring.
Maintain a balance between neutrality and usability.
This is a
work in progress
, Phi 4 is smoll so I can toy with it.
Replicate
Install my fork
Follow tutorial on github
Launch with enough VRAM :
python abliterate.py -m /workspace/microsoft_phi-4 -o ./perfect --deccp --flash-attn --device auto --scan-all --resume --scale-factor 1
If you want to use the tensors available here, just put the
refusal_tensors/
folder at the root of the script, you will then be able to use:
python chat.py -m /workspace/microsoft_phi-4
then select layer range "1;39", and scale factor to 1.0.
Rename the tensors as needed. My code is shit, please understand, idea is better than code. Do better. kek.
Runs of Undi95 Phi4-abliterated on huggingface.co
68
Total runs
0
24-hour runs
5
3-day runs
11
7-day runs
31
30-day runs
More Information About Phi4-abliterated huggingface.co Model
Phi4-abliterated huggingface.co
Phi4-abliterated huggingface.co is an AI model on huggingface.co that provides Phi4-abliterated's model effect (), which can be used instantly with this Undi95 Phi4-abliterated model. huggingface.co supports a free trial of the Phi4-abliterated model, and also provides paid use of the Phi4-abliterated. Support call Phi4-abliterated model through api, including Node.js, Python, http.
Phi4-abliterated huggingface.co is an online trial and call api platform, which integrates Phi4-abliterated's modeling effects, including api services, and provides a free online trial of Phi4-abliterated, you can try Phi4-abliterated online for free by clicking the link below.
Undi95 Phi4-abliterated online free url in huggingface.co:
Phi4-abliterated is an open source model from GitHub that offers a free installation service, and any user can find Phi4-abliterated on GitHub to install. At the same time, huggingface.co provides the effect of Phi4-abliterated install, users can directly use Phi4-abliterated installed effect in huggingface.co for debugging and trial. It also supports api for free installation.