# Runner API (recommended)fromsafetune.runnerimporthardentrainer=harden.LoXHardenTrainer(model,# base model to hardentokenizer,aligned_model_path="Qwen/Qwen2.5-0.5B-Instruct",# aligned referencerank=8,extrapolation_factor=0.3,)
fromsafetune.runnerimporthardentrainer=harden.LoXHardenTrainer(model,tokenizer,aligned_model_path="Qwen/Qwen2.5-0.5B-Instruct",rank=8,extrapolation_factor=0.3,)# .train() applies the LoX pre-FT extrapolation, then fine-tunes on your task data.out_path=trainer.train(task_dataset)
Best for: extrapolating the aligned model along the top-k singular directions of (W_aligned − W_base) before fine-tuning, so the safety subspace is reinforced.
Trade-offs: Training-free pre-FT step; adds a preprocessing pass before fine-tuning begins.