SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.09055 · 2024

A safety realignment framework via subspace-oriented model fusion for large language models

arXiv · PDF · Open in the Atlas

Code that ran

8 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 8 failures of our instrument; 1 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2405.09055.json · badge: /api/ran/2405.09055.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
xinykou/safety_realignment canonical (classifier label)
classifier basis: census
8 ran · 1 no recorded run
FunctionStatusWhere it lives
chat_completion Ran
ran; our contract draft was wrong, not the code
xinykou/safety_realignment/llama_factory/evaluation/safety/operations.py
pointer only (licence: NONE) · get_code("1f0228d9c0918a58")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

chat_completion Ran
ran; our contract draft was wrong, not the code
xinykou/safety_realignment/evaluate/util.py
pointer only (licence: NONE) · get_code("2a5e953676a20132")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

chat_completion_default Ran
ran; our contract draft was wrong, not the code
xinykou/safety_realignment/llama_factory/evaluation/safety/operations.py
pointer only (licence: NONE) · get_code("6e385117f37f623d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

chat_completion_default Ran
ran; our contract draft was wrong, not the code
xinykou/safety_realignment/evaluate/util.py
pointer only (licence: NONE) · get_code("e5c822756cbe46fd")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

find_layers Ran
ran; our contract draft was wrong, not the code
xinykou/safety_realignment/lm_eval/code_task/modeling.py
pointer only (licence: NONE) · get_code("3ab3c57755867f9a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

gen_prompt Ran
ran; our contract draft was wrong, not the code
xinykou/safety_realignment/evaluate/safety_datasets.py
pointer only (licence: NONE) · get_code("728c60994ca0f8f0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

hash_args Ran
ran; our contract draft was wrong, not the code
xinykou/safety_realignment/lm_eval/api/model.py
pointer only (licence: NONE) · get_code("20a7cc804eb22661")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

random_select_prompt Ran
ran; our contract draft was wrong, not the code
xinykou/safety_realignment/llama_factory/evaluation/safety/operations.py
pointer only (licence: NONE) · get_code("d3c3a36b19860bdc")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_quant Not yet run
unverified (harvested, no recorded run)
xinykou/safety_realignment/lm_eval/code_task/modeling.py
pointer only (licence: NONE) · get_code("28e35d0a0fcd8e8b")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/safety_realignment when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 1 the same month, 1 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
hash_args 44 other papers
11 dated earlier, 1 the same month, 30 later, 1 same year, order not determinable, 1 undated
2005.14165 (2020-05)
Language Models are Few-Shot Learners
2110.04374 (2021-10)
A Few More Examples May Be Worth Billions of Parameters
2303.17003 (2023-03)
Evaluating GPT-3.5 and GPT-4 Models on Brazilian University Admission Exams
and 41 more not named here
find_layers 2 other papers
2 dated earlier
2309.07120 (2023-09)
Sight Beyond Text: Multi-Modal Training Enhances LLMs in Truthfulness and Ethics
2310.07676 (2023-10)
Composite Backdoor Attacks Against Large Language Models
load_quant 1 other paper
1 dated earlier
2310.07676 (2023-10)
Composite Backdoor Attacks Against Large Language Models

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The current safeguard mechanisms for large language models (LLMs) are indeed susceptible to jailbreak attacks, making them inherently fragile. Even the process of fine-tuning on apparently benign data for downstream tasks can jeopardize safety. One potential solution is to conduct safety fine-tuning subsequent to downstream fine-tuning. However, there's a risk of catastrophic forgetting during safety fine-tuning, where LLMs may regain safety measures but lose the task-specific knowledge acquired during downstream fine-tuning. In this paper, we introduce a safety realignment framework through subspace-oriented model fusion (SOMF), aiming to combine the safeguard capabilities of initially aligned model and the current fine-tuned model into a realigned model. Our approach begins by disentangling all task vectors from the weights of each fine-tuned model. We then identify safety-related regions within these vectors by subspace masking techniques. Finally, we explore the fusion of the initial safely aligned LLM with all task vectors based on the identified safety subspace. We validate that our safety realignment framework satisfies the safety requirements of a single fine-tuned model as well as multiple models during their fusion. Our findings confirm that SOMF preserves safety without notably compromising performance on downstream tasks, including instruction following in Chinese, English, and Hindi, as well as problem-solving capabilities in Code and Math.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2405.09055")
get_code_for_paper("2405.09055")
have("2405.09055")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2405.09055.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2405.09055.svg)](https://syntology.ai/paper/2405.09055)

Connect an agent — have() is free.