Papers › Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors

Semantics-Adaptive Activation Intervention for LLMs via Dynamic Steering Vectors

16 Oct 2024arXiv:2410.12299archive 2025-07-28

Weixuan Wang, Jingyuan Yang, Wei Peng

Large language models (LLMs) have achieved remarkable performance across many tasks, yet aligning them with desired behaviors remains challenging. Activation intervention has emerged as an effective and economical method to modify the behavior of LLMs. Despite considerable interest in this area, current intervention methods exclusively employ a fixed steering vector to modify model activations, lacking adaptability to diverse input semantics. To address this limitation, we propose Semantics-Adaptive Dynamic Intervention (SADI), a novel method that constructs a dynamic steering vector to intervene model activations at inference time. More specifically, SADI utilizes activation differences in contrastive pairs to precisely identify critical elements of an LLM (i.e., attention heads, hidden states, and neurons) for targeted intervention. During inference, SADI dynamically steers model behavior by scaling element-wise activations based on the directions of input semantics. Experimental results show that SADI outperforms established baselines by substantial margins, improving task performance without training. SADI's cost-effectiveness and generalizability across various LLM backbones and tasks highlight its potential as a versatile alignment technique. In addition, we release the code to foster research along this line:https://github.com/weixuan-wang123/SADI.

PaperPDFCodeCode Syntology ran

In Syntology 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="2410.12299")

Code

Syntology Ran 10 of 14 code samples harvested from 1 repository linked to this paper; 4 have no recorded run. Of those that ran: 3 ran · our draft was wrong; 1 ran · fixture could not drive it; 6 ran with no contract checked.

By repository: official repository: 14 samples from 1 repository, 10 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

weixuan-wang123/SADI officialmentioned in papermentioned on GitHubpytorch 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

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

3ran · our draft was wrong
1ran · fixture could not drive it
6ran
4unverified

Licence: 14 of the 14 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 weixuan-wang123/SADI. “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.

repeat_kv weixuan-wang123/SADI/modeling_llama.py official repository ran · fixture could not drive it fingerprinted no licence file found · pointer only · 30d7eec482ebf6b1 · report
apply_rotary_pos_emb weixuan-wang123/SADI/modeling_llama.py official repository ran · our draft was wrong no licence file found · pointer only · bac65c3dafaec040 · report
evalone weixuan-wang123/SADI/steering.py official repository ran fingerprinted no licence file found · pointer only · 890f9a7e8b35a0ba · report
hierarchical_subsequence weixuan-wang123/SADI/util/nethook.py official repository ran no licence file found · pointer only · 920b394e7ad80c53 · report
load_mmlu weixuan-wang123/SADI/load_dataset.py official repository ran no licence file found · pointer only · c0785ff8deb3ee18 · report
push_key_prefix weixuan-wang123/SADI/util/runningstats.py official repository ran no licence file found · pointer only · 846b749e768edeaf · report
recursive_copy weixuan-wang123/SADI/util/nethook.py official repository ran · our draft was wrong no licence file found · pointer only · 70f6ab8bde55420e · report
rotate_half weixuan-wang123/SADI/modeling_llama.py official repository ran · our draft was wrong fingerprinted no licence file found · pointer only · b99eea6376d1e212 · report
sample_portion weixuan-wang123/SADI/util/runningstats.py official repository ran fingerprinted no licence file found · pointer only · e6620bfaf591afd4 · report
subsequence weixuan-wang123/SADI/util/nethook.py official repository ran no licence file found · pointer only · 440ff98c2b1ae1aa · report
dict_to_ weixuan-wang123/SADI/tok_dataset.py official repository unverified no licence file found · pointer only · 4b87278bcf65e54d · report
length_collation weixuan-wang123/SADI/tok_dataset.py official repository unverified no licence file found · pointer only · feecc08837987d77 · report
make_padded_batch weixuan-wang123/SADI/tok_dataset.py official repository unverified no licence file found · pointer only · 59ff38281d7c12b8 · report
tally weixuan-wang123/SADI/util/runningstats.py official repository unverified no licence file found · pointer only · edb0f31cbdd4f7d0 · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionSoftmax

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