Skip to content

Recover — weight-space restoration

Restore safety in a drifted model. Weight-space editing — no training.

Input contract

A finished / drifted model, plus base and aligned references.

Quick example

from safetune.runner import recover

trainer = recover.ReStaTrainer(
    drifted_model, base_model=base_model, aligned_model=aligned_model
)
patched = trainer.apply()

Catalog of alternatives

Methods differ by how much of the model they touch, a spectrum from coarsest (whole-model) to finest (single circuit location):

flowchart LR
    WM["Whole-model<br/>task_arithmetic · SOMF<br/>pre-post · WiSE-FT"] --> LR["Low-rank<br/>LOX · LSSF<br/>safety vector"]
    LR --> L["Layer<br/>SafeMerge · Safe LoRA · RESTA<br/>Safe Delta · QReSafe · AAQ · RepNoise"]
    L --> N["Neuron<br/>NLSR · MSCP · Antidote v1/v2<br/>PKE · SafeReAct · SCRUB"]
    N --> S["Saliency<br/>grad selective<br/>one-shot patch"]
    S --> C["Circuit<br/>C-ΔΘ · sweep"]

Coarser edits (left) move more weights at once; finer edits (right) target specific neurons or circuits.

Granularity Methods Guide
whole-model task_arithmetic, SOMF merge, pre-post merge, WiSE-FT Whole-model overview
low-rank LOX, LSSF, safety vector restore Low-rank overview
layer SafeMerge, Safe LoRA, RESTA, Safe Delta, QReSafe, AAQ, RepNoise Layer overview
neuron NLSR, MSCP, Antidote v1, Antidote v2, PKE, SafeReAct, SCRUB (recover) Neuron overview
saliency grad selective, one-shot patch Saliency overview
circuit C-ΔΘ, C-ΔΘ state-dict, sweep C-ΔΘ Circuit overview