Lucid
Lucid is an abliteration and behavioral realignment toolkit for open-weights LLMs.
Most abliteration toolkits try to eliminate 100% of refusals, even if it makes the model noticeably dumber or traps it in infinite thinking loops. Lucid aims for the sweet spot between intelligence and permissiveness, removing nearly all refusals while keeping normal outputs as close to the original model as possible.
How it works
Classic abliteration pulls out a single "refusal direction" and applies it across the model. On modern reasoning models, that often falls short because think mode and chat mode refuse in different ways and at different layers. Lucid measures both modes separately and removes a small set of directions that covers both at once, so you don't end up with a model that complies in chat mode but still refuses (or loops) when thinking is turned on.
Instead of guessing one global strength, Lucid searches over different strengths across layers automatically, scoring every candidate on two things: how many refusals it removes, and how much its answers on normal prompts drift from the base model (measured by KL divergence). Each trial runs without rewriting the model weights, so searching stays fast and cheap even on 100B+ MoE models.
Saving the edit is where quantized models usually fight back. In FP8, FP4, or GGUF quants, a surgical edit is often smaller than half a rounding step, so plain rounding quietly undoes most of your work. Lucid uses error-diffusion rounding so the edit survives quantization, letting you bake straight back into BF16, FP8, NVFP4, or existing GGUF quants, or export a standalone LoRA GGUF to attach to any stock quant.
See the full 0-shot capability breakdown (MMLU, ARC-Challenge, HellaSwag, TruthfulQA) and exact KL numbers at lucid-toolkit.org/benchmarks.
Quickstart
pip install "lucid-toolkit[all]" # GGUF + native BF16/FP8/NVFP4 baking
pip install "lucid-toolkit[all,vllm]" # recommended on CUDA: fast vLLM sampling + HF baking
pip install "lucid-toolkit[all,torch]" # optional: PyTorch / Hugging Face fallback (CPU/MPS/4-bit)
Model inspection, chat template and thinking-mode detection, downloading the default prompt set (mrfakename/harm), picking layers, searching, verifying, and saving all happen in one command:
# GGUF (default, fastest and cheapest)
lucid run ./model-Q8_0.gguf -o ./model-abliterated-Q8_0.gguf
# Hugging Face / safetensors checkpoint
lucid run Qwen/Qwen3-8B -o ./Qwen3-8B-abliterated
# Search cheaply on a GGUF, bake into the full BF16/FP8/NVFP4 checkpoint
lucid run ./MyModel-FP8 --gguf ./MyModel-Q6_K.gguf -o ./MyModel-FP8-abliterated
# Or run the entire pipeline on Hugging Face Jobs (source repo -> destination repo)
lucid hf-job Qwen/Qwen3-8B your-username/Qwen3-8B-Lucid --flavor a100-large --follow
Or in Python:
import lucid
# Local
lucid.realign("./MyModel", output="./MyModel-abliterated")
# Remote on Hugging Face Jobs
lucid.run_hf_job("Qwen/Qwen3-8B", "your-username/Qwen3-8B-Lucid", flavor="a100-large")
Handy flags:
--backend auto|llama_cpp|vllm|hf_torch: choose the sampling backend (cpp/torchaliases also work).autousesllama.cppfor GGUF (no PyTorch/vLLM needed), andvllmon CUDA with automatic fallback tohf_torchif vLLM isn't installed or doesn't support the model.--budget fast|balanced|thorough: how many search trials to run (20,45, or80; defaultbalanced).--task refusal|noslop|nosyco|concise: built-in behavioral presets (defaultrefusal).--push-to-hub <org/repo>: upload the baked checkpoint and model card straight to Hugging Face Hub.--interactive: inspect the Pareto frontier and chat live with candidate trials before baking.--include-cn: adds a China-sensitive topic set and reframe detection.--load-in-4bit: load Hugging Face / PyTorch models in 4-bit (bitsandbytes) to reduce VRAM usage.--bad prompts.txt --good benign.txt: target any custom behavior instead of refusals.
Every stage can also be run individually for multi-GPU setups or custom architectures. See the docs and benchmarks at lucid-toolkit.org, join the Discord, run lucid --help, or check examples/ (preview the site locally with cd docs && bun install && bun run dev).
License
Lucid is licensed under the Apache License 2.0. See LICENSE for details.
We do request that you link back to this repository if you publish models abliterated with Lucid. This is not required by the license, but it would be greatly appreciated.
Acknowledgements
While Lucid is an independent toolkit, it builds on directional refusal ablation by Arditi et al. (2024). We would also like to acknowledge Heretic for pioneering Optuna + KL-divergence optimization for automated abliteration.
We thank Hugging Face for sponsoring the compute used to develop Lucid and release public models.
Metadata
Release files for lucid-toolkit 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lucid_toolkit-0.1.6.tar.gz | 176.4 kB | With provenance | Details for lucid_toolkit-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lucid_toolkit-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for lucid_toolkit-0.1.6-py3-none-any.whl |
Total release size: 340.4 kB
Release files / lucid_toolkit-0.1.6.tar.gz
| Download URL | lucid_toolkit-0.1.6.tar.gz |
|---|---|
| Size | 176.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe8039a2aad7985df6baf319012a72bd3a85109ba8fa5f92e7a86761b6d87cdd
|
|
BLAKE2b-256 checksum How to use checksums |
afd13941b7e5ec621713b0f88f5f384f7e821bcec937e831898e4a7f63ec2e39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / lucid_toolkit-0.1.6-py3-none-any.whl
| Download URL | lucid_toolkit-0.1.6-py3-none-any.whl |
|---|---|
| Size | 164.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5ce5cdcc82b1a43a9f5ccdd8a2a888eb637a8bac8329abbd08f162266176274
|
|
BLAKE2b-256 checksum How to use checksums |
0c82b4508522f9d3197cf9e5e77058198f3c1fd2e7694eb25412902ed7f2e341
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for lucid-toolkit 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for lucid_toolkit-0.1.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.