Papers › Aligning Large Language Models with Representation Editing: A Control Perspective

Aligning Large Language Models with Representation Editing: A Control Perspective

10 Jun 2024arXiv:2406.05954archive 2025-07-28

Lingkai Kong, Haorui Wang, Wenhao Mu, Yuanqi Du, Yuchen Zhuang, Yifei Zhou, Yue Song, Rongzhi Zhang, Kai Wang, Chao Zhang

Aligning large language models (LLMs) with human objectives is crucial for real-world applications. However, fine-tuning LLMs for alignment often suffers from unstable training and requires substantial computing resources. Test-time alignment techniques, such as prompting and guided decoding, do not modify the underlying model, and their performance remains dependent on the original model's capabilities. To address these challenges, we propose aligning LLMs through representation editing. The core of our method is to view a pre-trained autoregressive LLM as a discrete-time stochastic dynamical system. To achieve alignment for specific objectives, we introduce external control signals into the state space of this language dynamical system. We train a value function directly on the hidden states according to the Bellman equation, enabling gradient-based optimization to obtain the optimal control signals at test time. Our experiments demonstrate that our method outperforms existing test-time alignment techniques while requiring significantly fewer resources compared to fine-tuning methods. Our code is available at https://github.com/Lingkai-Kong/RE-Control.

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="2406.05954")

Code

Syntology Ran 8 of 15 code samples harvested from 1 repository linked to this paper; 7 have no recorded run. Of those that ran: 2 ran · honoured contract; 1 ran · our draft was wrong; 5 ran with no contract checked.

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

lingkai-kong/re-control 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

15 samples harvested; 8 ran; 2 honoured the contract we drafted; 7 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.

2ran · honoured contract
1ran · our draft was wrong
5ran
7unverified

Licence: 15 of the 15 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 Lingkai-Kong/RE-Control. “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.

clean Lingkai-Kong/RE-Control/gpt4_eval.py official repository ran fingerprinted no licence file found · pointer only · 9d741ca160b48466 · report
clean Lingkai-Kong/RE-Control/metrics.py official repository ran fingerprinted no licence file found · pointer only · 3cf2a6616e939e43 · report
data_collactor Lingkai-Kong/RE-Control/reward_label.py official repository ran no licence file found · pointer only · caf88b9c8ecf956d · report
data_process lingkai-kong/re-control/measure_reward.py official repository ran · our draft was wrong fingerprinted no licence file found · pointer only · b2e30556f9379844 · report
get_rm Lingkai-Kong/RE-Control/reward_label.py official repository ran no licence file found · pointer only · eff184cc56e8bb4d · report
gpt4_eval Lingkai-Kong/RE-Control/gpt4_eval.py official repository ran fingerprinted no licence file found · pointer only · e891a84231ca8dd6 · report
test_epoch lingkai-kong/re-control/train_value_model.py official repository ran · honoured contract no licence file found · pointer only · 9e69e7d1e58dec6b · report
train_epoch lingkai-kong/re-control/train_value_model.py official repository ran · honoured contract no licence file found · pointer only · 1b355772493f759c · report
Intervented_LlamaForCausalLM lingkai-kong/re-control/intervented_model/llama.py official repository unverified no licence file found · pointer only · c19b40e338f183c3 · report
Intervented_LlamaModel lingkai-kong/re-control/intervented_model/llama.py official repository unverified no licence file found · pointer only · e5833ed42b181705 · report
compute_diversity Lingkai-Kong/RE-Control/metrics.py official repository unverified no licence file found · pointer only · 93c198d58d919707 · report
compute_rep_n Lingkai-Kong/RE-Control/metrics.py official repository unverified no licence file found · pointer only · 6c1c5b07ef997d49 · report
extract_out lingkai-kong/re-control/measure_reward.py official repository unverified no licence file found · pointer only · 66a8dc7918ff99ab · report
get_llm_activations Lingkai-Kong/RE-Control/get_activations_only.py official repository unverified no licence file found · pointer only · 71124f71d7503e4d · report
process_hidden_states Lingkai-Kong/RE-Control/get_activations_only.py official repository unverified no licence file found · pointer only · 27de88ce6534463a · report

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