Local Contrastive Editing of Gender Stereotypes (2024)

Abstract: Stereotypical bias encoded in language models (LMs) poses a threat to safe language technology, yet our understanding of how bias manifests in the parameters of LMs remains incomplete. We introduce local contrastive editing that enables the localization and editing of a subset of weights in a target model in relation to a reference model. We deploy this approach to identify and modify subsets of weights that are associated with gender stereotypes in LMs. Through a series of experiments we demonstrate that local contrastive editing can precisely localize and control a small subset ( < 0.5\% ) of weights that encode gender bias. Our work (i) advances our understanding of how stereotypical biases can manifest in the parameter space of LMs and (ii) opens up new avenues for developing parameter-efficient strategies for controlling model properties in a contrastive manner.

## introduction stereotypical bias encoded in language models (lms) can adversely affect the fairness and inclusivity of language technology applications for all users @xcite @xcite . while considerable efforts have been devoted to measuring @xcite and mitigating @xcite such biases, our understanding of where they manifest in the parameter space of lms remains limited. precisely pinpointing biases within the parameters of lms could enable the development of more targeted and informed bias mitigation strategies. while current research @xcite @xcite has explored identifying and modifying subcomponents of lms for bias mitigation, we still lack a thorough understanding of the precise manifestation of biases such as stereotypes in specific model weights. research goal consequently, this work aims to (i) localize individual weights that drive stereotypical gender bias in lms and (ii) modify these weights to steer and mitigate the bias. approach we present local contrastive editing, a two-step approach that enables the localization and modification of a subset of weights within a target model, relative to a reference model, to control bias (see figure 1 ). in step 1, we pinpoint individual weights that encode gender stereotypes via unstructured pruning @xcite . in step 2, we deploy various local editing strategies such as weight interpolation or pruning to adjust the identified weights in relation to a reference model. ## local contrastive editing we localize and adjust specific weights in a target model that are responsible for encoding properties such as stereotypical bias. to achieve this, we use several contrastive strategies based on comparing a target network with a reference network that differ in a property of interest. we refer to this group of techniques as contrastive weight editing. formally, let f (x, θ) be the output of a network with parameters θ ∈ r d for an example input x. given a target network f t (•, θ t ) and a reference network f r (•, θ r ) of the same architecture, with θ t , θ @xmath0, we aim to edit θ t w.r.t. θ r to modify a property of interest p in f t while maintaining performance on the original fine-tuning task. ## experimental setup we showcase the effectiveness of local contrastive editing in one of the, arguably, most established experimental environments for testing bias modification methods from the literature: stereotypical binary gender bias encoded in the bert 1 model @xcite . bert is a widely used transformer model with 12 attention heads and 110 million parameters in total. ## results we fine-tune bert according to section 4.1 and create models with stereotypical and antistereotypical biases. ## conclusion our research shows that stereotypical gender bias is primarily encoded in specific subsets of weights within lms. we propose various local contrastive editing strategies and demonstrate that they can effectively identify and modify these subsets to flexibly control and mitigate gender bias. this work enhances our understanding of where stereotypical biases manifest in the parameter space of lms and opens up new avenues for developing parameter-efficient strategies for model editing in a contrastive manner. local contrastive editing is not limited to gender bias, and future research could explore its application to other tasks and domains.