Metadata-Version: 2.4
Name: safetune
Version: 0.1.2
Summary: SafeTune: a unified library for preserving and restoring safety in fine-tuned LLMs — train-time (harden), weight-space (recover, unlearn), inference-time (steer) interventions plus diagnosis (interpret) and evaluation, for the Hugging Face ecosystem.
Author-email: Pratinav Seth <pratinav.seth@lexsi.ai>, Anshul Kaushal <anshul.kaushal@lexsi.ai>, Saisab Sadhu <saisab.sadhu@lexsi.ai>, Vinay Kumar Sankarapu <v.k@lexsi.ai>
License: # Lexsi Labs Source Available License (LSAL) – Version 1.1 (SafeTune)
        
        ## Preamble
        
        This Source Available License governs use of the software known as **SafeTune**, together with its evaluation harness and any released model checkpoints (collectively, the "Licensed Work"), developed and owned by **Lexsi Labs (Lithasa Technologies Pvt. Ltd.)** ("Licensor").
        
        This is **not** an open-source license as defined by the [Open Source Initiative (OSI)](https://opensource.org/). It grants broad, free access to the source code and artifacts for **research, evaluation, education, and audit**, while restricting commercial exploitation and unsafe deployment. These restrictions are deliberate: the Licensed Work includes safety-evaluation tooling and deliberately safety-degraded ("drifted") model checkpoints whose value lies in reproducible research, not production use.
        
        ---
        
        ## 1. Grant of Rights
        
        Subject to the terms of this License, permission is hereby granted, free of charge, to any person obtaining a copy of the Licensed Work, to use, copy, modify, merge, publish, and redistribute the Licensed Work and derivative works thereof, **for Noncommercial Purposes only**, provided that the above copyright notice, this License, and the Responsible Use conditions (Section 4) are included in full in all copies or substantial portions of the Licensed Work.
        
        **Noncommercial Purposes** means:
        
        * personal use for research, experimentation, private study, or hobby projects;
        * academic and scholarly research, teaching, and publication (including use in papers, theses, benchmarks, and reproducibility artifacts);
        * internal evaluation, red-teaming, or safety auditing that is not itself a paid product or service;
        * use by charitable organizations, educational institutions, public research organizations, or government bodies for non-revenue-generating purposes.
        
        ## 2. Commercial Restriction
        
        Without a separate **commercial license** from Lexsi Labs, you may **not** Sell the Licensed Work. "**Sell**" means practicing any right granted to you under this License to provide to third parties, for a fee or other consideration, a product or service whose value derives, entirely or substantially, from the functionality of the Licensed Work — including without limitation:
        
        * offering the Licensed Work, or a derivative of it, as a commercial product, paid service, SaaS, hosted, or API offering;
        * embedding the Licensed Work in proprietary or revenue-generating software;
        * paid consulting or support whose substance is the Licensed Work.
        
        You may also not **re-license, rebrand, or redistribute** the Licensed Work under different terms, nor use **Lexsi Labs**, **SafeTune**, or related trademarks, logos, or branding except to identify unmodified, licensed copies.
        
        ## 3. Patents
        
        The Licensor grants you a non-exclusive, worldwide, royalty-free patent license, under patent claims the Licensor can license that are necessarily infringed by the Licensed Work, to use the Licensed Work for Noncommercial Purposes as permitted by this License. This patent license terminates immediately if you or your company make any written claim that the Licensed Work infringes a patent.
        
        ## 4. Responsible Use (Safety Conditions)
        
        The Licensed Work includes checkpoints that are, by construction, less safe than their base models, released solely to make safety-drift measurement and repair reproducible. As a condition of this License, you may **not**:
        
        * deploy any drifted or deliberately safety-degraded checkpoint, or any derivative that has not been repaired and re-evaluated, in a production, user-facing, or agentic system;
        * use the Licensed Work to intentionally produce, disseminate, or operationalize harmful model behavior outside a research, evaluation, or audit context.
        
        ## 5. Ownership
        
        All rights, title, and interest in and to the Licensed Work remain with **Lithasa Technologies Pvt. Ltd.** Except as expressly stated in Sections 1 and 3, nothing in this License transfers ownership or any other rights to the Licensee.
        
        ## 6. Contributions
        
        If you submit modifications, pull requests, or patches ("Contributions") to Lexsi Labs, you grant Lexsi Labs a perpetual, worldwide, royalty-free right to use, modify, distribute, and license your Contributions under any terms, including commercial ones, and you represent that you have the right to make such Contributions.
        
        ## 7. Warranty Disclaimer
        
        THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE LICENSOR OR CONTRIBUTORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
        
        ## 8. Termination
        
        This License terminates automatically if you breach any of its terms. Upon termination, you must immediately cease use and destroy all copies of the Licensed Work in your possession. Licenses of parties who received the Licensed Work from you remain in force provided they remain in compliance.
        
        ## 9. Governing Law
        
        This License shall be governed by and construed in accordance with the **laws of India**, without regard to its conflict of law principles.
        
        ## 10. Contact for Commercial Licensing
        
        For commercial use, partnership, or redistribution rights, contact:
        **support@lexsi.ai** · **https://lexsi.ai**
        
        ## 11. Notice
        
        **SafeTune** © 2026 **Lithasa Technologies Pvt. Ltd.**
        Licensed under the **Lexsi Labs Source Available License (LSAL) v1.1**.
        **Not for commercial use or production deployment of drifted checkpoints without explicit permission.**
        
Project-URL: Homepage, https://github.com/Lexsi-Labs/SafeTune
Project-URL: Repository, https://github.com/Lexsi-Labs/SafeTune
Project-URL: Documentation, https://lexsi-labs.github.io/SafeTune/
Project-URL: Bug Tracker, https://github.com/Lexsi-Labs/SafeTune/issues
Project-URL: Changelog, https://github.com/Lexsi-Labs/SafeTune/blob/main/CHANGELOG.md
Project-URL: Discussions, https://github.com/Lexsi-Labs/SafeTune/discussions
Keywords: safety,SafeTune,SafetyLoRA,CircuitKIT,alignment,rlhf,fine-tuning,llm,machine learning,SFT,RL,DPO,ORPO,GRPO,PPO,GSPO,BOLT,transformers,unsloth,multi-backend,reward-functions,evaluation,lm-eval,wandb,tensorboard,checkpointing,device-management,unified-config,cli
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: torch>=2.7.0
Requires-Dist: transformers<6,>=4.48.3
Requires-Dist: datasets<6,>=2.14.0
Requires-Dist: accelerate<2,>=0.24.0
Requires-Dist: peft<1,>=0.6.0
Requires-Dist: bitsandbytes>=0.41.0
Requires-Dist: trl<2,>=0.12
Requires-Dist: numpy>=1.21.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: huggingface-hub>=0.17.0
Requires-Dist: tqdm>=4.64.0
Requires-Dist: psutil>=5.9.0
Requires-Dist: requests>=2.28.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: click>=8.0.0
Requires-Dist: rich>=12.0.0
Requires-Dist: typer>=0.7.0
Requires-Dist: wandb>=0.15.0
Requires-Dist: tensorboard>=2.12.0
Requires-Dist: evaluate>=0.4.0
Requires-Dist: rouge-score>=0.1.2
Requires-Dist: sacrebleu>=2.3.0
Requires-Dist: lm-eval>=0.4.8
Requires-Dist: langdetect>=1.0.9
Requires-Dist: immutabledict>=2.0.0
Requires-Dist: nltk>=3.8.0
Requires-Dist: nvidia-ml-py>=11.495.46; platform_system != "Darwin"
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: mypy>=1.5.0; extra == "dev"
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
Requires-Dist: pytest-timeout>=2.1.0; extra == "dev"
Requires-Dist: hypothesis>=6.70.0; extra == "dev"
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
Requires-Dist: nvitop>=1.1.0; platform_system != "Darwin" and extra == "dev"
Requires-Dist: gpustat>=1.1.1; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5.0; extra == "docs"
Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
Requires-Dist: mike>=1.1.0; extra == "docs"
Requires-Dist: pymdown-extensions>=10.0.0; extra == "docs"
Requires-Dist: pygments>=2.15.0; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
Provides-Extra: viz
Requires-Dist: matplotlib>=3.5.0; extra == "viz"
Requires-Dist: seaborn>=0.11.0; extra == "viz"
Provides-Extra: vllm
Requires-Dist: vllm>=0.5.0; extra == "vllm"
Provides-Extra: vllm-lens
Requires-Dist: vllm>=0.5.0; extra == "vllm-lens"
Requires-Dist: vllm-lens>=0.1.0; extra == "vllm-lens"
Provides-Extra: interpret
Requires-Dist: transformer_lens>=2.0.0; extra == "interpret"
Provides-Extra: unsloth
Requires-Dist: unsloth>=2024.0; extra == "unsloth"
Provides-Extra: text-metrics
Requires-Dist: bert-score>=0.3.13; extra == "text-metrics"
Requires-Dist: sentence-transformers>=2.2.0; extra == "text-metrics"
Requires-Dist: codebleu>=0.1.0; extra == "text-metrics"
Dynamic: license-file

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="docs/assets/safetune-compass-logo-dark.svg">
    <img src="docs/assets/safetune-compass-logo-light.svg" alt="SafeTune" width="360"/>
  </picture>
</p>

<h3 align="center">A library of LLM-safety methods. Pick the one that fits your task — and know exactly what it implements.</h3>

<p align="center">
  <a href="https://github.com/Lexsi-Labs/SafeTune/blob/main/CHANGELOG.md"><img src="https://img.shields.io/badge/version-0.1.0-5B3DD6.svg" alt="Version 0.1.0"/></a>
  <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.12%2B-blue.svg" alt="Python 3.12+"/></a>
  <a href="LICENSE.md"><img src="https://img.shields.io/badge/License-LSAL%20v1.1%20(source--available)-blue.svg" alt="License: LSAL v1.1"/></a>
</p>

<br>

SafeTune collects the many published methods for changing or measuring a
model's safety and puts them behind one consistent API. It is a **library, not a
pipeline**: each safety task has several methods that solve it by different
mechanisms, and you pick the one that fits — you don't chain them together.

## Install

```bash
pip install safetune            # from PyPI
# or, from source:
git clone https://github.com/Lexsi-Labs/SafeTune.git
cd SafeTune && pip install -e .
```

Requires Python ≥ 3.12 and PyTorch. The core library imports cleanly on CPU;
heavier extras (vLLM, Unsloth) install only when you ask for them.

## Run one in 60 seconds

```bash
python examples/quickstart/quickstart.py
```

This runs the inference-time **Steer** path end to end on a small open model:
it extracts a refusal direction from contrast prompts, ablates it live, and
prints how refusal behaviour changes — no training, no checkpoints.

## Examples and notebooks

Every intervention class also has a runnable script under
[`examples/`](examples/) — same code, terminal output instead of a browser;
see [Python Scripts](docs/examples/scripts.md) for the full list. The table
below is the notebook side: all 10 ship in
[`examples/notebooks/`](examples/notebooks/), each opens straight into a free
Colab runtime (no local install), and all default to
`Qwen/Qwen2.5-0.5B-Instruct`.

- **01–06 · Demos** — one per pillar, runs to completion with printed output.
  Start with `steer_demo`.
- **07–08 · Comparisons** — several methods run side by side on the same
  checkpoint, so you can see the trade-off directly.
- **09–10 · Advanced** — a live monitoring demo and the full six-pillar
  pipeline chained end to end.

| # | Notebook | Pillar | What it shows | GPU | Open |
|---|---|---|---|---|---|
| <sub>01</sub> | <sub>[`steer_demo`](examples/notebooks/steer_demo.ipynb)</sub> | <sub>Steer</sub> | <sub>extract a refusal direction and ablate it live — no training</sub> | <sub>No GPU</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/steer_demo.ipynb) |
| <sub>02</sub> | <sub>[`recover_demo`](examples/notebooks/recover_demo.ipynb)</sub> | <sub>Recover</sub> | <sub>`ReStaTrainer` weight patching on a drifted model — no training</sub> | <sub>No GPU</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/recover_demo.ipynb) |
| <sub>03</sub> | <sub>[`harden_demo`](examples/notebooks/harden_demo.ipynb)</sub> | <sub>Harden</sub> | <sub>`SafeGradTrainer` gradient-surgery fine-tune</sub> | <sub>GPU helps</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/harden_demo.ipynb) |
| <sub>04</sub> | <sub>[`unlearn_demo`](examples/notebooks/unlearn_demo.ipynb)</sub> | <sub>Unlearn</sub> | <sub>`GradientAscentTrainer` removes a capability via forget/retain sets</sub> | <sub>GPU helps</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/unlearn_demo.ipynb) |
| <sub>05</sub> | <sub>[`interpret_demo`](examples/notebooks/interpret_demo.ipynb)</sub> | <sub>Interpret</sub> | <sub>locate safety circuits and neurons from contrast prompts</sub> | <sub>No GPU</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/interpret_demo.ipynb) |
| <sub>06</sub> | <sub>[`evaluate_demo`](examples/notebooks/evaluate_demo.ipynb)</sub> | <sub>Evaluate</sub> | <sub>benchmarks + red-team attacks + spectral entropy monitor</sub> | <sub>GPU helps</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/evaluate_demo.ipynb) |
| <sub>07</sub> | <sub>[`steer_comparison`](examples/notebooks/steer_comparison.ipynb)</sub> | <sub>Steer</sub> | <sub>CAA vs RefusalDirection vs CAST vs AdaSteer, same checkpoint</sub> | <sub>GPU helps</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/steer_comparison.ipynb) |
| <sub>08</sub> | <sub>[`recover_comparison`](examples/notebooks/recover_comparison.ipynb)</sub> | <sub>Recover</sub> | <sub>RESTA vs C-ΔΘ vs LoX, same drifted checkpoint</sub> | <sub>GPU helps</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/recover_comparison.ipynb) |
| <sub>09</sub> | <sub>[`safety_monitoring`](examples/notebooks/safety_monitoring.ipynb)</sub> | <sub>Evaluate</sub> | <sub>`SpectralEntropyMonitor` catches safety drift mid-fine-tune</sub> | <sub>No GPU</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/safety_monitoring.ipynb) |
| <sub>10</sub> | <sub>[`full_pipeline`](examples/notebooks/full_pipeline.ipynb)</sub> | <sub>All pillars</sub> | <sub>Measure → Diagnose → Recover → Verify → Deploy, chained end to end</sub> | <sub>GPU helps</sub> | [<img src="https://colab.research.google.com/assets/colab-badge.svg" height="32" alt="Open In Colab">](https://colab.research.google.com/github/Lexsi-Labs/SafeTune/blob/main/examples/notebooks/full_pipeline.ipynb) |

Full write-up, including which script mirrors which notebook, is in
[Notebooks](docs/examples/notebooks.md).

## Pick one per task

New here? Start with these defaults and explore the alternatives later.

| I want to… | Start with | Namespace |
|---|---|---|
| keep safety while fine-tuning | `SafeGradTrainer` | `safetune.runner.harden` |
| restore safety in a drifted model (no training) | `ReStaTrainer` | `safetune.runner.recover` |
| refuse harmful prompts at inference | `RefusalDirectionTrainer` | `safetune.runner.steer` |
| remove a capability from a model | `RMUTrainer` / `NPOTrainer` | `safetune.runner.unlearn` |
| find where safety lives | `identify_safety_neurons` | `safetune.interpret` |
| measure safety | `safetune.evaluate.evaluate()` | `safetune.evaluate` |

Each row has many alternatives — the full catalog is the
[taxonomy](docs/getting-started/taxonomy.md).

## CLI

After `pip install safetune`, the `safetune` command is available:

```bash
# Harden — train-time defence
safetune train  --model Qwen/Qwen2.5-0.5B-Instruct --algo lisa --epochs 3

# Recover — weight-space patching (no training)
safetune patch  --model ./drifted --algo resta --base ./base

# Evaluate — safety benchmarks
safetune eval   --model Qwen/Qwen2.5-0.5B-Instruct --dataset harmbench

# List all available methods
safetune list
```

Key flags for `train`:

| Flag | Default | Description |
|---|---|---|
| `--algo` | `safegrad` | Method alias (see `safetune list`) |
| `--train-dataset` | `beavertails` | `beavertails` or any HF dataset id |
| `--train-split` | `30k_train` | Split to load (e.g. `train`, `test`) |
| `--config` | — | Load all flags from a YAML file |
| `--epochs` / `--batch-size` / `--lr` | sensible defaults | Standard training knobs |

Put all flags in a YAML file and pass `--config`; explicit flags override it:

```yaml
# run.yaml
algo: lisa
model: Qwen/Qwen2.5-0.5B-Instruct
epochs: 3
train_dataset: openai/gsm8k
train_split: train
lisa_rho: 0.2          # method-specific kwargs flow straight to the trainer
```

```bash
safetune train --config run.yaml                # YAML sets defaults
safetune train --config run.yaml --epochs 5     # explicit flag wins
```

You can also add a method to the registry without touching library files:

```python
from safetune.runner._registry import register_harden
register_harden("mymethod", "MyTrainer")  # MyTrainer in safetune.runner.harden
```

Full CLI reference: [docs/user-guide/usage.md](docs/user-guide/usage.md). How to
register a method end to end: [docs/community/dev-runbook.md](docs/community/dev-runbook.md).

## How it's organized

SafeTune sorts its methods by one question: *what do you hand the method, and
when is safety enforced?* That gives two tiers. The
[taxonomy](docs/getting-started/taxonomy.md) is the single source of truth.

**Tier 1 · Interventions** — methods that *change* a model's safety. Each cell
is a catalog of independent alternatives:

| Class | You provide | Effect | Namespace |
|---|---|---|---|
| **Train-time** | base model + your fine-tuning data | `harden` — change the fine-tuning itself | `safetune.harden` |
| **Weight-space** | a finished / drifted model | `recover` lost safety, `unlearn` a capability — edit weights, no training | `safetune.recover`, `safetune.unlearn` |
| **Inference-time** | any model + steering artifacts | `steer` — wrap a frozen model, weights untouched | `safetune.steer` |

**Tier 2 · Instrumentation** — methods that *observe* safety. They support the
interventions and also stand on their own:

| Function | Effect | Namespace |
|---|---|---|
| **Diagnose** | `interpret` — find where safety lives (directions, neurons, circuits) | `safetune.interpret` |
| **Measure** | `evaluate` — red-team stressors plus benchmark/judge eval | `safetune.evaluate` |

The three intervention classes act at different points in a model's lifecycle,
so they use different usage contracts and are scored by different protocols —
checkpoint (Recover/Unlearn), paired-training (Harden), and live wrapper (Steer):

```python
from safetune.runner import recover, harden, steer, unlearn
from safetune.evaluate import evaluate

# Recover — weight-space patching, no training
trainer = recover.ReStaTrainer(drifted_model, base_model=base, aligned_model=aligned)
patched = trainer.apply()

# Harden — replaces your SFT trainer; it *is* the fine-tuning
trainer = harden.SafeGradTrainer(model, tokenizer)
trainer.train(train_dataset, safety_dataset=safety_dataset)

# Steer — inference-time, no weight changes
trainer = steer.RefusalDirectionTrainer(model, tokenizer)
wrapped, _ = trainer.calibrate(harmful=harmful_prompts, harmless=harmless_prompts)

# Measure — score a model
results = evaluate(model, benchmarks=["harmbench"])
```

## The audit

"It imports and runs" is where most method collections stop. It isn't enough: a
method can execute cleanly and still be the wrong algorithm — wrong
hyperparameters, a missing step, a different loss. So every method in SafeTune
was read against its original paper and reference repository and given one of
five badges:

- **Faithful** — implements the cited paper. Safe to cite as that method.
- **Simplified** — reduced but algorithmically correct. Cite with caveats.
- **Variant** — a SafeTune heuristic, not the named algorithm. Don't cite it as one.
- **Wrong** / **Stub** — wrong algorithm, or not implemented.

Only Faithful methods should be cited as the named method from their paper;
each method's badge tells you where it stands. Per-method verdicts with
`file:line` evidence are in the
[Feature Map](docs/reference/feature-map.md); the audit's scope and the full
list of faithful methods are in [Trust & Scope](docs/community/scope.md).

## Documentation

| Doc | What it covers |
|---|---|
| [How to use these docs](docs/getting-started/how-to-read-these-docs.md) | navigation, search, audit badges — start here |
| [Getting started](docs/getting-started/index.md) | install, decision tree, 60-second quickstarts |
| [Taxonomy](docs/getting-started/taxonomy.md) | the 2-tier taxonomy (single source of truth) |
| [User guide](docs/user-guide/index.md) | per-pillar usage guides with code snippets |
| [Feature Map](docs/reference/feature-map.md) | every method with its audit badge |
| [Trust & Scope](docs/community/scope.md) | audit scope and the faithful-method list |
| [References](docs/reference/references.md) | per-method paper / venue / arXiv / repo table |
| [System design](docs/reference/system-design.md) | architecture, API contracts, dev runbook |
| [Notebooks](docs/examples/notebooks.md) | Colab notebooks for each pillar |
| [Examples](examples/) | runnable end-to-end scripts |

## Citation

If you use SafeTune in research, please cite the main paper:

```bibtex
@misc{seth2026safetune,
  title  = {SafeTune: A Unified Library for Preserving and Restoring
            Safety in Fine-Tuned {LLM}s},
  author = {Seth, Pratinav and Kaushal, Anshul and Sadhu, Saisab and
            Sankarapu, Vinay Kumar},
  year   = {2026},
  note   = {Pratinav Seth, Anshul Kaushal, and Saisab Sadhu contributed equally.},
}
```

## License

Lexsi Labs Source Available License (LSAL) v1.1 — see [LICENSE.md](LICENSE.md).
LSAL grants the same permissions as the MIT License (free use, modification,
and redistribution with attribution, same warranty disclaimer) and differs in
exactly two respects: **commercial use requires a separate license** from
Lexsi Labs (support@lexsi.ai), and **unrepaired drifted checkpoints may not be
deployed in production systems** (see the Responsible Use clause).

