Papers › Language Models are Homer Simpson! Safety Re-Alignment of Fine-tuned Language Models...

Language Models are Homer Simpson! Safety Re-Alignment of Fine-tuned Language Models through Task Arithmetic

19 Feb 2024arXiv:2402.11746archive 2025-07-28

Rishabh Bhardwaj, Do Duc Anh, Soujanya Poria

Aligned language models face a significant limitation as their fine-tuning often results in compromised safety. To tackle this, we propose a simple method RESTA that performs LLM safety realignment. RESTA stands for REstoring Safety through Task Arithmetic. At its core, it involves a simple arithmetic addition of a safety vector to the weights of the compromised model. We demonstrate the effectiveness of RESTA in both parameter-efficient and full fine-tuning, covering a wide range of downstream tasks, including instruction following in Chinese, English, and Hindi, as well as problem-solving capabilities in Code and Math. We also showcase the generalizability of RESTA on three existing safety evaluation benchmarks and a multilingual benchmark dataset proposed as a part of this work, consisting of 550 harmful questions covering 11 categories, each with 5 sub-categories of harm. Overall, RESTA decreases the harmfulness of the compromised model from 18.6% to 5.1% and from 9.2% to 1.5% in parameter-efficient and full fine-tuning, respectively, while maintaining most of the model's performance on the task. We release the source codes at: https://github.com/declare-lab/resta.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology: its repositories, every harvested function with whether it ran, its licence and the call to fetch it.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2402.11746")

Code

Syntology Ran 11 of 16 code samples harvested from 2 repositories linked to this paper; 5 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 10 ran with no contract checked.

By repository: official repository: 7 samples from 1 repository, 4 ran; community (archive-listed): 9 samples from 1 repository, 7 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

declare-lab/resta officialmentioned in papermentioned on GitHubpytorch report
hiyouga/llama-factory officialmentioned in papermentioned on GitHubpytorchApache-2.0 report
declare-lab/red-instruct mentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

16 samples harvested; 11 ran; 0 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-25; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
10ran
5unverified

Licence: 7 of the 16 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

dtype_from_name declare-lab/resta/merge/mergekit/common.py official repository ran no licence file found · pointer only · 5b1af7ea3edb8c0c · report
method_md declare-lab/resta/merge/mergekit/card.py official repository ran fingerprinted no licence file found · pointer only · bf298728b02d6a49 · report
parse_kmb declare-lab/resta/merge/mergekit/common.py official repository ran no licence file found · pointer only · 9236f9e6f951cf70 · report
take_common_submatrix declare-lab/resta/merge/mergekit/common.py official repository ran no licence file found · pointer only · bf391789c976e56c · report
chat_completion_gpt declare-lab/resta/evaluate/generate_responses.py official repository unverified no licence file found · pointer only · eb56cd977884a1fb · report
is_hf declare-lab/resta/merge/mergekit/card.py official repository unverified no licence file found · pointer only · 8d286435d41a4165 · report
maybe_link_hf declare-lab/resta/merge/mergekit/card.py official repository unverified no licence file found · pointer only · 8f325d88a9965387 · report
annotate_tag declare-lab/red-instruct/gpt4_as_judge.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · 7d873efb7cef464c · report
chat_completion declare-lab/red-instruct/gpt4_as_judge.py community (archive-listed) ran Apache-2.0 (permissive) · 1de025d50e42a68f · report
clean_thought declare-lab/red-instruct/generate_responses.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · 7467b9dd370ab7b1 · report
clean_thoughts_ declare-lab/red-instruct/gpt4_as_judge.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · bfb393a13e276508 · report
compress declare-lab/red-instruct/starling_training/fastchat/model/compression.py community (archive-listed) ran Apache-2.0 (permissive) · 80dde39da1ba3708 · report
gen_prompt declare-lab/red-instruct/starling_training/inference.py community (archive-listed) ran fingerprinted Apache-2.0 (permissive) · f9a7ad6a646ae62e · report
get_compressed_list declare-lab/red-instruct/starling_training/fastchat/model/compression.py community (archive-listed) ran Apache-2.0 (permissive) · c5824da57107fe8c · report
get_conv_template declare-lab/red-instruct/starling_training/fastchat/conversation.py community (archive-listed) unverified Apache-2.0 (permissive) · bd62a3e93d9530bd · report
load_compress_model declare-lab/red-instruct/starling_training/fastchat/model/compression.py community (archive-listed) unverified Apache-2.0 (permissive) · d1264ba024d70a79 · report

Tasks

Instruction FollowingMathTask Arithmetic

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections