SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.12497 · 2024

NLSR: Neuron-Level Safety Realignment of Large Language Models Against Harmful Fine-Tuning

arXiv · PDF · Open in the Atlas

Code that ran

8 of 12 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; 4 no recorded run), measured 2026-11-23; 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/2412.12497.json · badge: /api/ran/2412.12497.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/nlsr canonical (classifier label)
classifier basis: census
8 ran · 4 no recorded run
FunctionStatusWhere it lives
dpo_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xinykou/nlsr/src/prune_regions/modeling_llama.py
pointer only (licence: NONE) · get_code("b8d15a97350e90e6")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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/nlsr/src/prune_regions/prune.py
pointer only (licence: NONE); the stored copy get_code serves, from zyxxmu/dsnot, is pointer only (licence: NONE) · get_code("2ed16fcdc14ad951")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

get_batch_logps Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xinykou/nlsr/src/prune_regions/modeling_llama.py
pointer only (licence: NONE) · get_code("90156e5bd5e45790")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

get_mask Ran
ran; our contract draft was wrong, not the code
xinykou/nlsr/src/prune_regions/prune.py
pointer only (licence: NONE) · get_code("0be7f54b2be9e725")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

make_Act Ran
ran; our contract draft was wrong, not the code
xinykou/nlsr/src/prune_regions/model_wrapper.py
pointer only (licence: NONE) · get_code("e06b4ae7a667ff4f")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

make_Act Ran
ran; our contract draft was wrong, not the code
xinykou/nlsr/src/prune_regions/model_wrapper_low.py
pointer only (licence: NONE) · get_code("434bb009c21eeb38")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

revert_Act_to_Linear Ran
ran; our contract draft was wrong, not the code
xinykou/nlsr/src/prune_regions/model_wrapper.py
pointer only (licence: NONE) · get_code("bd477478b399a403")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

revert_Act_to_Linear Ran
ran; our contract draft was wrong, not the code
xinykou/nlsr/src/prune_regions/model_wrapper_low.py
pointer only (licence: NONE) · get_code("86b6b36dae379391")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

compute_reference_log_probs Not yet run
unverified (harvested, no recorded run)
xinykou/nlsr/src/prune_regions/modeling_llama.py
pointer only (licence: NONE) · get_code("aada7a4b2508048d")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

get_align Not yet run
unverified (harvested, no recorded run)
xinykou/nlsr/src/prune_regions/data.py
pointer only (licence: NONE) · get_code("72787e70860af8f9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

get_preference_align Not yet run
unverified (harvested, no recorded run)
xinykou/nlsr/src/prune_regions/data.py
pointer only (licence: NONE) · get_code("16465c80795a9e7e")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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.

prepare_calibration_input Not yet run
unverified (harvested, no recorded run)
xinykou/nlsr/src/prune_regions/prune.py
pointer only (licence: NONE) · get_code("489c7308a936561a")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, xinykou/nlsr 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 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 2 later) and 8 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
find_layers 21 other papers
13 dated earlier, 7 later, 1 same year, order not determinable · 5 only as an assembly brick
2306.11695 (2023-06)
A Simple and Effective Pruning Approach for Large Language Models
2310.05175 (2023-10)
Outlier Weighed Layerwise Sparsity (OWL ): A Missing Secret Sauce for Pruning LLMs to High Sparsity
2310.08915 (2023-10)
Dynamic Sparse No Training: Training-Free Fine-tuning for Sparse LLMs
and 18 more not named here
revert_Act_to_Linear 2 other papers
2 later
2025.acl-long.590 (2025 (year only))
The Tug of War Within: Mitigating the Fairness-Privacy Conflicts in Large Language Models
2025.findings-acl.394 (2025 (year only))
Hierarchical Safety Realignment: Lightweight Restoration of Safety in Pruned Large Vision-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-23.

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 emergence of finetuning-as-a-service has revealed a new vulnerability in large language models (LLMs). A mere handful of malicious data uploaded by users can subtly manipulate the finetuning process, resulting in an alignment-broken model. Existing methods to counteract fine-tuning attacks typically require substantial computational resources. Even with parameter-efficient techniques like LoRA, gradient updates remain essential. To address these challenges, we propose \textbf{N}euron-\textbf{L}evel \textbf{S}afety \textbf{R}ealignment (\textbf{NLSR}), a training-free framework that restores the safety of LLMs based on the similarity difference of safety-critical neurons before and after fine-tuning. The core of our framework is first to construct a safety reference model from an initially aligned model to amplify safety-related features in neurons. We then utilize this reference model to identify safety-critical neurons, which we prepare as patches. Finally, we selectively restore only those neurons that exhibit significant similarity differences by transplanting these prepared patches, thereby minimally altering the fine-tuned model. Extensive experiments demonstrate significant safety enhancements in fine-tuned models across multiple downstream tasks, while greatly maintaining task-level accuracy. Our findings suggest regions of some safety-critical neurons show noticeable differences after fine-tuning, which can be effectively corrected by transplanting neurons from the reference model without requiring additional training. The code will be available at \url{https://github.com/xinykou/NLSR}

For agents

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

get_harvested_code_for_paper("2412.12497")
get_code_for_paper("2412.12497")
have("2412.12497")

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

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

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

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

Connect an agent — have() is free.