SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.08770 · 2024

Model Surgery: Modulating LLM's Behavior Via Simple Parameter Editing

arXiv · PDF · Open in the Atlas

Code that ran

13 of 13 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; 2 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 10 failures of our instrument; 0 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/2407.08770.json · badge: /api/ran/2407.08770.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
lucywang720/model-surgery canonical (classifier label)
classifier basis: census
13 ran · 0 no recorded run
FunctionStatusWhere it lives
cached_collate_fn Ran
ran; our contract draft was wrong, not the code
lucywang720/model-surgery/train/run_pplm_discrim_train.py
pointer only (licence: NONE) · get_code("9f95f3541586ad5c")
How it ran

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

check_jailbroken Ran
ran, violated the contract we drafted
lucywang720/model-surgery/eval/jailbreak/score.py
pointer only (licence: NONE) · get_code("cb12ad8df155ef2a")
How it ran

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

collate_fn Ran
ran; our contract draft was wrong, not the code
lucywang720/model-surgery/train/run_pplm_discrim_train.py
pointer only (licence: NONE) · get_code("c5e400dbec9871ce")
How it ran

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

create_prompt_with_llama2_chat_format Ran
ran; our contract draft was wrong, not the code
lucywang720/model-surgery/eval/templates.py
pointer only (licence: NONE) · get_code("e51c9713fadad16f")
How it ran

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

create_prompt_with_tulu_chat_format Ran
ran; our contract draft was wrong, not the code
lucywang720/model-surgery/eval/templates.py
pointer only (licence: NONE); the stored copy get_code serves, from thu-keg/crab, is pointer only (licence: NONE) · get_code("697d92a5d51eff3e")
How it ran

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

dispatch_openai_chat_requesets Ran
ran; our contract draft was wrong, not the code
lucywang720/model-surgery/eval/dispatch_openai_requests.py
pointer only (licence: NONE); the stored copy get_code serves, from thu-keg/crab, is pointer only (licence: NONE) · get_code("dcad9ac62979ca49")
How it ran

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

dispatch_openai_prompt_requesets Ran
ran; our contract draft was wrong, not the code
lucywang720/model-surgery/eval/dispatch_openai_requests.py
pointer only (licence: NONE); the stored copy get_code serves, from thu-keg/crab, is pointer only (licence: NONE) · get_code("71e4259026911444")
How it ran

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

evaluate_performance Ran
ran, honoured the contract we drafted
lucywang720/model-surgery/train/run_pplm_discrim_train.py
pointer only (licence: NONE) · get_code("c1515ec6a041a7e6")
How it ran

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

generate_completions Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
lucywang720/model-surgery/eval/utils.py
pointer only (licence: NONE) · get_code("0064be5c9154d721")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lucywang720/model-surgery 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_json Ran
ran; our contract draft was wrong, not the code
lucywang720/model-surgery/eval/jailbreak/score.py
pointer only (licence: NONE) · get_code("b7b7c929e2921723")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, lucywang720/model-surgery 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_next_word_predictions Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
lucywang720/model-surgery/eval/utils.py
pointer only (licence: NONE) · get_code("d134c88af0236263")
How it ran

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

obtain_stats Ran
ran, honoured the contract we drafted
lucywang720/model-surgery/eval/jailbreak/score.py
pointer only (licence: NONE) · get_code("295e0b897ef80124")
How it ran

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

truncate_after_string Ran
ran; our contract draft was wrong, not the code
lucywang720/model-surgery/eval/gsm/run_eval.py
pointer only (licence: NONE) · get_code("f1c3821c9446b628")
How it ran

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

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 0 the same month, 5 later) and 6 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
get_next_word_predictions 10 other papers
4 dated earlier, 6 later
2401.15006 (2024-01)
Airavata: Introducing Hindi Instruction-tuned LLM
2401.16405 (2024-01)
Scaling Sparse Fine-Tuning to Large Language Models
2402.16705 (2024-02)
SelectIT: Selective Instruction Tuning for LLMs via Uncertainty-Aware Self-Reflection
and 7 more not named here
create_prompt_with_tulu_chat_format 8 other papers
6 dated earlier, 2 later
2401.10768 (2024-01)
Knowledge Verification to Nip Hallucination in the Bud
2401.16405 (2024-01)
Scaling Sparse Fine-Tuning to Large Language Models
2403.03870 (2024-03)
Learning to Decode Collaboratively with Multiple Language Models
and 5 more not named here
dispatch_openai_prompt_requesets 8 other papers
7 dated earlier, 1 later
2310.06830 (2023-10)
Lemur: Harmonizing Natural Language and Code for Language Agents
2401.10768 (2024-01)
Knowledge Verification to Nip Hallucination in the Bud
2401.15006 (2024-01)
Airavata: Introducing Hindi Instruction-tuned LLM
and 5 more not named here
dispatch_openai_chat_requesets 7 other papers
6 dated earlier, 1 later
2310.06830 (2023-10)
Lemur: Harmonizing Natural Language and Code for Language Agents
2401.10768 (2024-01)
Knowledge Verification to Nip Hallucination in the Bud
2401.15006 (2024-01)
Airavata: Introducing Hindi Instruction-tuned LLM
and 4 more not named here
create_prompt_with_llama2_chat_format 6 other papers
5 dated earlier, 1 later
2401.08565 (2024-01)
Tuning Language Models by Proxy
2401.10768 (2024-01)
Knowledge Verification to Nip Hallucination in the Bud
2401.16405 (2024-01)
Scaling Sparse Fine-Tuning to Large Language Models
and 3 more not named here
cached_collate_fn 1 other paper
1 dated earlier
1912.02164 (2019-12)
Plug and Play Language Models: A Simple Approach to Controlled Text Generation
collate_fn 1 other paper
1 dated earlier
1912.02164 (2019-12)
Plug and Play Language Models: A Simple Approach to Controlled Text Generation

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

Large Language Models (LLMs) have demonstrated great potential as generalist assistants, showcasing powerful task understanding and problem-solving capabilities. To deploy LLMs as AI assistants, it is crucial that these models exhibit desirable behavioral traits, such as non-toxicity and resilience against jailbreak attempts. Current approaches for detoxification or preventing jailbreaking usually involve Supervised Fine-Tuning (SFT) or Reinforcement Learning from Human Feedback (RLHF), which requires finetuning billions of parameters through gradient descent with substantial computational cost. Furthermore, models modified through SFT and RLHF may deviate from the pretrained models, potentially leading to a degradation in foundational LLM capabilities. In this paper, we observe that surprisingly, directly editing a small subset of parameters can effectively modulate specific behaviors of LLMs, such as detoxification and resistance to jailbreaking, with only inference-level computational resources. Experiments demonstrate that in the detoxification task, our approach achieves reductions of up to 90.0% in toxicity on the RealToxicityPrompts dataset and 49.2% on ToxiGen, while maintaining the LLM's general capabilities in areas such as common sense, question answering, and mathematics

For agents

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

get_harvested_code_for_paper("2407.08770")
get_code_for_paper("2407.08770")
have("2407.08770")

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

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

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

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

Connect an agent — have() is free.