Metadata-Version: 2.4
Name: annihilate-llm
Version: 1.4.5
Summary: Fully automatic censorship removal for language models
Project-URL: Homepage, https://github.com/tjcrims0nx/annihilation-llm
Project-URL: Documentation, https://github.com/tjcrims0nx/annihilation-llm
Project-URL: Repository, https://github.com/tjcrims0nx/annihilation-llm.git
Project-URL: Issues, https://github.com/tjcrims0nx/annihilation-llm/issues
Project-URL: Changelog, https://github.com/tjcrims0nx/annihilation-llm/releases
Author: grimxlock
Maintainer: grimxlock
License-Expression: AGPL-3.0-or-later
License-File: LICENSE
Keywords: abliteration,llm,transformer
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Environment :: GPU
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: accelerate~=1.13
Requires-Dist: aiohttp>=3.14.3
Requires-Dist: bitsandbytes~=0.49
Requires-Dist: compressed-tensors>=0.15.0
Requires-Dist: datasets<6.0,>=4.7
Requires-Dist: huggingface-hub~=1.7
Requires-Dist: immutabledict~=4.3
Requires-Dist: langdetect~=1.0
Requires-Dist: lm-eval[hf]~=0.4
Requires-Dist: numpy~=2.2
Requires-Dist: optuna~=4.7
Requires-Dist: peft~=0.19
Requires-Dist: pillow>=10.0
Requires-Dist: psutil~=7.2
Requires-Dist: py-cpuinfo~=9.0
Requires-Dist: pydantic-settings~=2.13
Requires-Dist: python-dotenv~=1.0
Requires-Dist: questionary~=2.1
Requires-Dist: rich<16.0,>=14.3
Requires-Dist: sentencepiece~=0.2
Requires-Dist: tiktoken~=0.12
Requires-Dist: tomli-w~=1.2
Requires-Dist: torch>=2.13
Requires-Dist: torchvision>=0.28
Requires-Dist: tqdm~=4.67
Requires-Dist: transformers[kernels]~=5.6
Provides-Extra: research
Requires-Dist: geom-median~=0.1; extra == 'research'
Requires-Dist: imageio~=2.37; extra == 'research'
Requires-Dist: matplotlib~=3.10; extra == 'research'
Requires-Dist: pacmap~=0.8; extra == 'research'
Requires-Dist: scikit-learn~=1.7; extra == 'research'
Description-Content-Type: text/markdown

# ⚔️ Annihilation

<div align="center">
  <img src="./logo.jpeg" alt="Annihilation Logo" width="300"/>
</div>

**Autonomous Language Model Decensoring Framework**

[![License: AGPLv3](https://img.shields.io/badge/License-AGPLv3-blue.svg)](LICENSE)
[![Python 3.10+](https://img.shields.io/badge/Python-3.10%2B-green)](https://www.python.org/)
[![PyTorch 2.2+](https://img.shields.io/badge/PyTorch-2.2%2B-red)](https://pytorch.org/)

---

## 🔥 What is Annihilation?

**Annihilation** is a fully automatic framework designed to remove censorship (safety alignment) from transformer-based language models. By using advanced parametric directional ablation and TPE-based optimization, it autonomously finds the absolute best parameters to decensor your models without requiring any expensive post-training.

### Key Features
- 🤖 **Fully Autonomous**: No human intervention required.
- 🖥️ **Terminal UI**: A beautiful, real-time dashboard built in Rust.
- ⚡ **Zero-Shot Decensoring**: Removes refusals while preserving the model's core capabilities.
- 🌌 **OBLITERATUS Integration**: Advanced experimental algorithms (COSMIC Layer Selection, Gaussian-shaped ablation kernels, and Expert-Granular Abliteration) integrated directly from OBLITERATUS.
- 🎯 **Broad Transformer Compatibility**: Supports transformer-based dense, MoE, hybrid, and multimodal architectures. Less-tested model families may require architecture-specific tensor targeting and output-quality validation.

---

## 🖥️ The Annihilation TUI

Annihilation features a high-performance **Rust Terminal User Interface (TUI)** that manages the entire workflow for you.

### Splash Screen & Setup
Easily configure your optimization preset and select models. You can even resume interrupted runs using the built-in Checkpoint System!
<div align="center">
  <img src="./assets/tui-splash.png" alt="Annihilation TUI Splash Screen" width="800"/>
</div>

### Live Processing Dashboard
Once running, monitor everything in real-time. The dashboard features dynamic sparkline charts for KL Divergence and Refusals, hardware monitoring, and color-coded live logs.
<div align="center">
  <img src="./assets/tui-dashboard.png" alt="Annihilation TUI Processing Dashboard" width="800"/>
</div>

---

## 🌌 OBLITERATUS Advanced Options

You can now toggle experimental algorithms directly from the TUI configuration menu by selecting **OBLITERATUS Advanced**. This enables:

- **COSMIC Layer Selection**: Instead of blindly searching across the entire network, the system analyzes cosine similarities between harmless and harmful residual streams. It automatically anchors the optimization process around the mathematically proven optimal layer, massively reducing the search space.
- **Expert-Granular Abliteration (EGA)**: For Mixture-of-Experts (MoE) models, EGA calculates the alignment score of each expert's weight matrix against the target refusal direction. Instead of applying a flat penalty, experts containing high concentrations of refusal vectors are aggressively modified while benign knowledge experts are perfectly preserved.
- **Gaussian-shaped Ablation Kernels**: Replaces traditional rigid interpolation bounds with a smooth, bell-shaped Gaussian curve to distribute weight changes across adjacent layers. This results in smoother vector blending and better text coherence post-ablation.

---

## ⚠️ Direct CLI Usage (Advanced)

If you want to bypass the TUI entirely and use the core Python CLI, you can run it directly from the virtual environment:

```powershell
.\.venv\Scripts\python.exe -m annihilate --help
# Example:
.\.venv\Scripts\python.exe -m annihilate --model openbmb/MiniCPM5-1B --n-trials 200
```

---

## 🚀 Quick Start

Ensure you have **Python 3.10+** and **Rust** installed, and that your PyTorch installation supports CUDA (if you are using an NVIDIA GPU).

### Setup & Launch

```powershell
git clone https://github.com/tjcrims0nx/annihilation-llm.git
cd annihilation-llm
.\start.bat
```

> 💡 **Note:** The very first time you run this, it will take a minute to compile the Rust TUI and set up the Python virtual environment. Subsequent launches will be near-instant! You do **not** need to manually build the project; the `start.bat` script handles all compilation and environment setup on the fly.

---

## 📜 License & Disclaimer

**Annihilation** is distributed under the **GNU Affero General Public License v3**. See [LICENSE](LICENSE) for details.

> ⚡ **Disclaimer**: This tool is provided for **research and educational purposes** only. We do not condone the use of decensored models for harmful activities. Users are entirely responsible for ensuring their compliance with applicable laws and Terms of Service.

<div align="center">
**Breaking the Chains | Unleashing Model Potential**
</div>
