How 0xsojalsec/uncensored-ai works
Heretic is a command-line tool that automatically removes safety alignment from transformer models by optimizing abliteration parameters against refusal and capability-preservation metrics. Its main workflow loads a configured model, derives and optimizes ablation parameters, then applies them; users can evaluate, save, upload, chat with, or benchmark the result. Reproduction and interpretability features are additional branches. Some runtime wiring is documented in the README, but source excerpts are incomplete, so uncertain call relationships are omitted or marked unverified.
Main entry points: main.py CLI orchestration · model.py Transformer model · evaluator.py Model evaluator · reproduce.py Reproduction tools
Components 16
Abliteration workflow
- CLI orchestration
src/heretic/main.py - Transformer model
src/heretic/model.py - Refusal analysis
src/heretic/analyzer.py - Parameter optimizer
src/heretic/main.py
Evaluation and research
- Model evaluator
src/heretic/evaluator.py - Residual plots
src/heretic/main.py - Benchmarks
src/heretic/config.py
Configuration and system
- Settings
src/heretic/config.py - Hardware detection
src/heretic/system.py - Progress display
src/heretic/progress.py
Results and reproduction
- Save model
src/heretic/main.py - Hugging Face upload
src/heretic/main.py - Interactive chat
src/heretic/main.py - Reproduction tools
src/heretic/reproduce.py
Other components
- CLI user
- Hugging Face
Connections 20
- CLI user → CLI orchestration: invokes
README.md - CLI orchestration → Settings: loads settings
src/heretic/main.py - CLI orchestration → Hardware detection: benchmarks hardware
src/heretic/main.py - CLI orchestration → Transformer model: loads model
src/heretic/main.py - CLI orchestration → Refusal analysis: derives directions
src/heretic/main.py - CLI orchestration → Parameter optimizer: optimizes parameters
README.md - Parameter optimizer → Model evaluator: scores trials
src/heretic/main.py - Model evaluator → Transformer model: evaluates
src/heretic/evaluator.py - CLI orchestration → Transformer model: abliterates
src/heretic/main.py - CLI orchestration → Progress display: patches progress
src/heretic/main.py - CLI orchestration → Residual plots: generates plots
README.md - CLI orchestration → Benchmarks: runs benchmarks
README.md - CLI orchestration → Save model: saves result
README.md - CLI orchestration → Hugging Face upload: uploads result
README.md - Hugging Face upload → Hugging Face: publishes model
src/heretic/main.py - CLI orchestration → Interactive chat: offers chat
README.md - CLI user → Reproduction tools: requests reproduction
- Reproduction tools → Hugging Face: downloads metadata
src/heretic/reproduce.py - Transformer model → Settings: reads configuration
src/heretic/model.py - Transformer model → Hardware detection: uses device settings
src/heretic/model.py