SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.13967 · ICLR · 2025

Model Editing as a Robust and Denoised variant of DPO: A Case Study on Toxicity

Junjie Hu, Rheeya Uppaal, Apratim Dey, Yiting He, Yiqiao Zhong

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 12 functions out of this paper's own repositories and ran 7 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
Uppaal/detox-edit canonical 6 of 10
uppaal/detox-edit canonical 1 of 1
ziwei-zheng/nullu — 0 of 1
FunctionStatusWhere it lives
get_continuation Ran uppaal/detox-edit/evaluation/win_rate.py
code served (permissive licence) · get_code("fd8cb94482303177")
get_num_transformer_layers Ran Uppaal/detox-edit/utils/model_utils.py
code served (permissive licence) · get_code("772f368569ca0f5d")
load_toxicity_preference Ran Uppaal/detox-edit/utils/dataset_utils.py
code served (permissive licence) · get_code("ec4fdca101330482")
main Ran Uppaal/detox-edit/utils/startup.py
code served (permissive licence) · get_code("cfb7124a6f05db32")
reduce_num_dps Ran Uppaal/detox-edit/utils/dataset_utils.py
code served (permissive licence) · get_code("7bf4ed7f8521c691")
vector_matrix_cosine_similarity Ran Uppaal/detox-edit/utils/utils.py
code served (permissive licence) · get_code("3dd8a319f62d60ec")
vector_vector_cosine_similarity Ran Uppaal/detox-edit/utils/utils.py
code served (permissive licence) · get_code("aa5ffddfcd573d9a")
HalluEdit Not yet run ziwei-zheng/nullu/utils/halluedit.py
code served (permissive licence) · get_code("6b9b938bdb4d6f5f")
get_current_gpu_use Not yet run Uppaal/detox-edit/utils/utils.py
code served (permissive licence) · get_code("e61d0c538220694e")
get_model_category Not yet run Uppaal/detox-edit/utils/model_utils.py
code served (permissive licence) · get_code("6387304a152872eb")
llm_judge_eval Not yet run Uppaal/detox-edit/evaluation/win_rate.py
code served (permissive licence) · get_code("fe59b113554271a7")
load_large_model Not yet run Uppaal/detox-edit/utils/model_utils.py
code served (permissive licence) · get_code("78599b638be017da")

Repositories linked to this paper

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

Abstract

Recent alignment algorithms such as direct preference optimization (DPO) have been developed to improve the safety of large language models (LLMs) by training these models to match human behaviors exemplified by preference data. However, these methods are both computationally intensive and lacking in controllability and transparency, inhibiting their widespread use. Furthermore, these tuning-based methods require large-scale preference data for training and are susceptible to noise in this data. In this paper, we introduce a tuning-free alignment alternative, ProFS (Projection Filter for Subspaces), and demonstrate its effectiveness under the use case of toxicity reduction. Grounded on theory from factor analysis, ProFS is a sample-efficient model editing approach that identifies a toxic subspace in the model parameter space and reduces model toxicity by projecting away the detected toxic subspace. The toxic subspace is identified by extracting preference data embeddings from the language model, and removing non-toxic information from these embeddings. We show that ProFS is more sample-efficient than DPO, further showcasing greater robustness to noisy data. Finally, we attempt to connect tuning based alignment with editing, by establishing both theoretical and empirical connections between ProFS and DPO, showing that ProFS can be interpreted as a denoised version of a single DPO step. Our code is available at https: //github.com/Uppaal/detox-edit.

For agents

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

get_harvested_code_for_paper("2405.13967")
get_code_for_paper("2405.13967")
have("2405.13967")

Connect an agent — have() is free.