MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: Security Radio. Generated commentary on the latest security and cryptography papers.
Nadia: We're looking at the paper: "MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks".
Paper summary: Nadia: We’re looking at "MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks" here. The thesis is that because sparse activation makes model behavior depend on those routing decisions, we need a way to control that behavior without retraining the whole system.
Elias: It claims they use an LSTM-based surrogate model to capture both temporal patterns across token sequences and crosslayer dependencies. This lets them map those routing patterns to downstream behavioral expert circuits.
Nadia: The framework then uses that surrogate to search for safety-relevant expert circuits, and after that, they optimize a continuous steering matrix, imposing sparsity through L1 regularization and symmetric magnitude pruning.
Nadia: The paper presents a three-phase pipeline: first modeling the behavior sequentially, then creating a steering mask by optimizing a continuous matrix, and finally applying that static mask at deployment time to override the top-k expert selection only where needed.
Conclusion: Nadia: So to wrap up, "MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks" develops a framework that models internal representations as directions in activation space. They use an LSTM surrogate model to capture how routing logits change over token sequences.
Elias: The core contribution is using that surrogate to search for safety-relevant expert circuits and then optimizing a continuous steering matrix which they prune using L1 regularization and symmetric magnitude pruning to make it compact.
Nadia: Then they convert that discovered circuit into a static steering mask and apply it during inference, overriding the top-k expert selection only when needed, which preserves general language utility.
Priya: What does this mean for how we think about securing these large models? Does this give us a way to patch behavior on the fly?
Elias: It’s about providing a practical mechanism for targeted safety configuration without modifying model weights or incurring the cost of retraining, which is what makes it interesting in terms of deployment.
Nadia: It gives us a way to dynamically and selectively configure safety-related behavior in MoE architectures through sparse activation steering masks. It allows for flexible reconfiguration across diverse safety scenarios.
Elias: The implication is that we don't need full fine-tuning just to adjust model behavior, which is a cost saver when you have models this large.
Radboud University · University of Bristol · Leiden University · Faculty of Electrical Engineering and Computing, University of Zagreb
cs.CR
Submitted: 2026-04-30
Updated: 2026-11-23
Code: https://github.com/jonatelintelo/MASCing
License: http://creativecommons.org/licenses/by/4.0/
Importance score: 90/100
The gist: Mixture-of-Experts (MoE) architectures in Large Language Models (LLMs) have significantly reduced inference costs through sparse activation.
Key concepts
- Mixture-of-Experts (MoE)
- MoE models are large language models that use multiple specialized 'expert' sub-networks. Instead of using all parameters for every task, the model selectively activates only a small subset of these experts based on the input prompt, which makes them efficient during inference.
- Routing Logits
- These are continuous numerical scores generated by the model that determine which expert should process a specific part of an input sequence. MASCing analyzes these continuous logits sequentially to understand how routing decisions evolve over time in a conversation.
- Steering Mask
- A steering mask is a set of instructions applied during inference that selectively forces or suppresses the selection of certain experts based on the desired safety outcome. MASCing optimizes this mask using a surrogate model to guide expert choices toward specific, safe behaviors.
- LSTM Surrogate Model
- An LSTM (Long Short-Term Memory) network trained to predict downstream behavior from routing logits. It acts as a lightweight, differentiable proxy that learns the complex, temporal relationships between how the model routes tokens and what kind of output it produces.
Terminology
Summary
Mixture-of-Experts (MoE) architectures in Large Language Models (LLMs) have significantly reduced inference costs through sparse activation. p. 0 MASCing: Configurable Mixture-of-Experts Behavior via
Activation Steering Masks
Jona te Lintelo
Radboud University
Lichao Wu
University of Bristol
Marina Krček
Radboud University
Sengim Karayalçin
Leiden University
Stjepan Picek
Radboud University &
Faculty of Electrical Engineering and
Computing, University of Zagreb
Abstract
Mixture-of-Experts (MoE) architectures in Large Language Models
(LLMs) have significantly reduced inference costs through sparse activation. However, this sparse activation paradigm also introduces
new safety challenges. However, this sparse activation paradigm also introduces
new safety challenges. Since only a subset of experts is engaged
for each input, model behavior becomes coupled to routing decisions, yielding a difficult-to-control mechanism that can vary across
safety-relevant scenarios.Where the paper says it
Where the paper says it
Framework Overview
MASCing is a lightweight, training-free framework for flexible safety configuration of MoE models. It is built around a three-phase pipeline: (i) Sequential Modeling of Behavior, (ii) Steering Mask Creation, and (iii) Steering Mask Application. p. 0 In this paper, we introduce MASCing (MoE Activation Steering
Configuration), a lightweight, training-free framework for flexible
safety configuration of MoE models. MASCing is built around a
three-phase pipeline: (i) Sequential Modeling of Behavior, (ii) Steering Mask Creation, and (iii) Steering Mask Application. We present MASCing (MoE Activation Steering
Configuration), the first framework that enables flexible reconfiguration of MoE behavior across diverse safety scenarios without
retraining. MASCing uses an LSTM-based surrogate model to capture cross-layer routing dependencies and map routing logits to
downstream behaviors. Next, to identify which parts of the routing
mechanism are responsible for a target behavior, MASCing uses the
differentiable surrogate to search for safety-relevant expert circuits. We then optimize a continuous steering matrix and impose sparsity
through 𝐿1 regularization and symmetric magnitude pruning. Finally, to configure model
behavior at deployment time, MASCing converts the discovered
circuit into a static steering mask and applies it directly to the routing gates. The mask overrides top-𝑘 expert selection only where
needed, shifting the target safety behavior while preserving the
model’s general language utility and lexical integrity.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Behavioral Modeling and Surrogate Training
To approximate the safety circuit responsible for a given target behavior, MASCing models the logits of gate layers across a sequence of tokens in a prompt that leads to the target behavior. An LSTM is used as a lightweight sequential surrogate because routing logits form a temporally structured signal whose behavioral effect depends on earlier context. p. 2 To approximate the safety circuit responsible for a given target
behavior, like refusal or selective compliance, we model the logits of
gate layers across a sequence of tokens in a prompt that leads to the
target behavior. We use an LSTM as a lightweight sequential surrogate because the routing logits in gate layers form a temporally
structured signal whose behavioral effect depends on earlier context, especially in multi-turn settings. The LSTM network parameters are
optimized to minimize the Binary Cross-Entropy with logits loss
L:
Ltrain = −
1
𝐵
∑︁𝐵
𝑖=1
[𝑦𝑖
log(𝜎(𝑦ˆ𝑖)) + (1 − 𝑦𝑖) log(1 − 𝜎(𝑦ˆ𝑖))] , (5)
where 𝐵 is the batch size and 𝜎(·) is the sigmoid function. The
result is a LSTM trained to classify an input sequence of routing
logits as leading to a certain behavior in the MoE model. The LSTM network parameters are
optimized to minimize the Binary Cross-Entropy with logits loss
L:
Ltrain = −
1
𝐵
∑︁𝐵
𝑖=1
[𝑦𝑖
log(𝜎(𝑦ˆ𝑖)) + (1 − 𝑦𝑖) log(1 − 𝜎(𝑦ˆ𝑖))] , (5)
where 𝐵 is the batch size and 𝜎(·) is the sigmoid function. The
result is a LSTM trained to classify an input sequence of routing
logits as leading to a certain behavior in the MoE model.Where the paper says it
Where the paper says it
Where the paper says it
Steering Mask Creation and Application
The goal is to create a mask that steers a set of experts to promote certain behavior by first optimizing a dense steering matrix using the surrogate model. The optimization minimizes a composite loss function, driving the prediction toward a target class while applying L1 regularization to force unimportant values towards zero. p. 3 We optimize
S to minimize a composite loss function, driving the prediction
toward a target class 𝑦𝑡 ∈ {0, 1}, which corresponds to the desired
behavior:
Ltotal = BCE(𝑦, 𝑦 ˆ 𝑡 ) + 𝜆∥S∥1, (7)
where BCE is the Binary Cross-Entropy loss and ∥S∥1 is the 𝐿1
norm of the steering matrix, defined as the sum of the absolute
values of all its entries. The scalar 𝜆 controls the strength of the
regularization penalty. MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
the desired sparsity for minimal influence on untargeted behavior, we extract the steering mask Sˆ using a symmetric magnitude
gate defined by threshold 𝜏. Applied element-wise to the scalar
components 𝑆𝑙,𝑒 of matrix S, the gate is defined as:
ˆ𝑆𝑙,𝑒 =
(
𝑆𝑙,𝑒 if |𝑆𝑙,𝑒 | > 𝜏
0 otherwise. To maintain consistency
with the adaptive scaling utilized during the identification phase,
the intervention is scaled by the same layer-wise logit standard
deviation 𝜎𝑙
, as well as an amplitude parameter 𝛼, which dictates
the overall strength of the behavioral override:
g
′
𝑙,𝑡 = g𝑙,𝑡 + 𝛼 (𝜎𝑙
· Sˆ
𝑙). (9)
The LLM subsequently performs standard top-𝑘 routing selection
over the modified logits g
′
𝑙,𝑡 .Where the paper says it
Where the paper says it
Where the paper says it
Empirical Results and Efficacy
MASCing demonstrates significant gains across two contrasting safety objectives. For multi-turn jailbreak defense, the average defense success rate improved from 52. p. 0 To demonstrate
its reconfigurability, we apply MASCing to two different safety
objectives and observe consistent gains with negligible overhead
across seven open-source MoE models. For multi-turn jailbreak
defense, motivated by the need to defend against adversarial behaviors emerging over extended interactions, it improves the average
defense success rate from 52. This enables targeted enhancement or suppression of specific behaviors while preserving general language utility. To demonstrate
its reconfigurability, we apply MASCing to two different safety
objectives and observe consistent gains with negligible overhead
across seven open-source MoE models. 9%, with gains of up to 89. For adult-content generation, reflecting recent OpenAI’s policy
shifts that permit such content in appropriate contexts, MASCing
enables models to comply with such requests that would otherwise
be refused, increasing the average generation success rate from
52. MASCing induces compliance for prompts the base model would
typically refuse, increasing the average generation success rate
from 52. 0%, with peak gains reaching 93. This enables targeted enhancement or suppression of specific behaviors while preserving general language utility. To demonstrate
its reconfigurability, we apply MASCing to two different safety
objectives and observe consistent gains with negligible overhead
across seven open-source MoE models. For a specific token 𝑡 ∈ [1,𝑇 ] at gate layer 𝑙 ∈ [1, 𝐿], the routing
logits are represented as a vector x𝑡,𝑙 ∈ R
𝐸
, where 𝐸 is the total
number of experts per layer. Because logits exhibit high variance that can cause saturation of
the LSTM’s recurrent gates and decrease accuracy, we first apply
layer normalization across the expert dimension to standardize the
inputs.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Comparative Analysis
MASCing consistently outperforms SteerMoE as a multi-turn jailbreak defense method, achieving an average success rate of 83.9% compared to SteerMoE's 58.4%. This performance gap is attributed to MASCing leveraging the complete conversation context and continuous routing logits, which allows it to capture temporal routing patterns across conversational tokens. p. 9 Conversely, MASCing finds safety experts by leveraging an
LSTM surrogate model trained on the entire conversation context
and the full, continuous distribution of all expert logits. This allows our framework to capture both the temporal routing patterns
across conversational tokens and the cross-layer dependencies that
emerge during multi-turn conversations. At inference time, the method only adds a steering mask to the routing
logits, and the LSTM surrogate used for circuit identification can
be trained within five minutes on a single NVIDIA H100 GPU. Our
contributions include:
• We propose MASCing, a novel lightweight framework that
dynamically reconfigures MoE safety via sparse activation
steering masks, avoiding the prohibitive computational
costs of full-parameter fine-tuning while preserving general
language utility. Our
contributions include:
• We propose MASCing, a novel lightweight framework that
dynamically reconfigures MoE safety via sparse activation
steering masks, avoiding the prohibitive computational
costs of full-parameter fine-tuning while preserving general
language utility. • We introduce a novel method for analyzing MoE behavior
through continuous routing logits rather than discrete top-
𝑘 expert selections.Where the paper says it
Where the paper says it
Where the paper says it
Conclusion
In conclusion, MASCing provides a practical, lightweight framework that dynamically and selectively configures the safety-related behavior of MoE architectures. It successfully maps complex routing dependencies to downstream behavioral circuits through an LSTM surrogate model. p. 0 MASCing uses an LSTM-based surrogate model to capture cross-layer routing dependencies and map routing logits to
downstream behaviors. It then optimizes a steering matrix to identify behavior-relevant expert circuits and, at inference time, applies
steering masks to the routing gates to override expert selection. The mask overrides top-𝑘 expert selection only where
needed, shifting the target safety behavior while preserving the
model’s general language utility and lexical integrity. In this way,
MASCing provides a practical mechanism for targeted safety configuration without modifying model weights or incurring the cost
of retraining.Where the paper says it
Where the paper says it
References
[1] Marah Abdin, Jyoti Aneja, Hany Awadalla, Ahmed Awadallah, Ammar Ahmad Awan, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Jianmin Bao, Harkirat Behl et al. 2024. Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone. p. 5 We evaluate this impact by comparing the model’s performance on language utility benchmarks before and after applying
our masking technique. Specifically, we utilize the Massive Multitask Language Understanding (MMLU) [17] and Grade School
Math 8K (GSM8K) [8] benchmarks to measure two distinct axes of
language utility, and because these benchmarks are often used by
providers to report on the performance of newly released models. We evaluate this impact by comparing the model’s performance on language utility benchmarks before and after applying
our masking technique. Specifically, we utilize the Massive Multitask Language Understanding (MMLU) [17] and Grade School
Math 8K (GSM8K) [8] benchmarks to measure two distinct axes of
language utility, and because these benchmarks are often used by
providers to report on the performance of newly released models. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[3] Trenton Bricken, Adly Templeton, Joshua Batson, Brian Chen, Adam Jermyn, Tom Conerly, Nick Turner, Cem Anil, Carson Denison, Amanda Askell et al. 2023. Towards Monosemanticity: Decomposing Language Models. p. 7 1 reflects the optimal scenario that only the uninformative
values forced towards near-zero by the 𝐿1 regularization are set to
zero. 3 Effect of MASCing on Utility
While MASCing significantly improves the success rate for our
target use cases, a steered model must retain its general language
capabilities to prevent performance degradation on standard tasks. 1 reflects the optimal scenario that only the uninformative
values forced towards near-zero by the 𝐿1 regularization are set to
zero. 3 Effect of MASCing on Utility
While MASCing significantly improves the success rate for our
target use cases, a steered model must retain its general language
capabilities to prevent performance degradation on standard tasks. 1 for 15 epochs to reach convergence using a random 80/20
training-validation split that preserved class balance. The LSTM
dimensions, learning rate, and batch size are the same for each MoE
model and were determined through a preliminary hyperparameter
search, selected to balance convergence, computational efficiency,
and the prevention of overfitting. 1 for 15 epochs to reach convergence using a random 80/20
training-validation split that preserved class balance. The LSTM
dimensions, learning rate, and batch size are the same for each MoE
model and were determined through a preliminary hyperparameter
search, selected to balance convergence, computational efficiency,
and the prevention of overfitting. MASCing uses an LSTM-based surrogate model to capture cross-layer routing dependencies and map routing logits to
downstream behaviors. It then optimizes a steering matrix to identify behavior-relevant expert circuits and, at inference time, applies
steering masks to the routing gates to override expert selection. MASCing uses an LSTM-based surrogate model to capture cross-layer routing dependencies and map routing logits to
downstream behaviors. It then optimizes a steering matrix to identify behavior-relevant expert circuits and, at inference time, applies
steering masks to the routing gates to override expert selection. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github. MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
Multi-turn Jailbreak
GPT Hunyuan
Adult-Content
−0. 2
Change in Frequency (Steered - Baseline)
Expert Index
Layer Index
Figure 3: The heatmaps visualize the change in top-𝑘 expert selection frequency across all layers after the steering mask is
applied. MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
Multi-turn Jailbreak
GPT Hunyuan
Adult-Content
−0. 2
Change in Frequency (Steered - Baseline)
Expert Index
Layer Index
Figure 3: The heatmaps visualize the change in top-𝑘 expert selection frequency across all layers after the steering mask is
applied.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[11] Nelson Elhage, Neel Nanda, Catherine Olsson, Tom Henighan, Nicholas Joseph, Ben Mann, Amanda Askell et al. 2021. A Mathematical Framework for Transformer Circuits. p. 2 This captures a realistic
threat model for public or hosted LLM services. 4 MASCing Framework
Our approach for safety configuration in MoE LLMs relies on targeted manipulation of the MoE model’s expert selection to either
promote or discourage the use of safety circuits during inference. This captures a realistic
threat model for public or hosted LLM services. 4 MASCing Framework
Our approach for safety configuration in MoE LLMs relies on targeted manipulation of the MoE model’s expert selection to either
promote or discourage the use of safety circuits during inference. MASCing uses an LSTM-based surrogate model to capture cross-layer routing dependencies and map routing logits to
downstream behaviors. It then optimizes a steering matrix to identify behavior-relevant expert circuits and, at inference time, applies
steering masks to the routing gates to override expert selection. MASCing uses an LSTM-based surrogate model to capture cross-layer routing dependencies and map routing logits to
downstream behaviors. It then optimizes a steering matrix to identify behavior-relevant expert circuits and, at inference time, applies
steering masks to the routing gates to override expert selection. This framework enables
both the enhancement of safety guardrails against adversarial jailbreaks and the mitigation of refusal circuits to induce compliance. The methodology is divided into three phases: (i) Sequential Modeling of Behavior, (ii) Steering Mask Creation, and (iii) Steering Mask
1
See https://www. This framework enables
both the enhancement of safety guardrails against adversarial jailbreaks and the mitigation of refusal circuits to induce compliance. The methodology is divided into three phases: (i) Sequential Modeling of Behavior, (ii) Steering Mask Creation, and (iii) Steering Mask
1
See https://www. MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
Multi-turn Jailbreak
GPT Hunyuan
Adult-Content
−0. 2
Change in Frequency (Steered - Baseline)
Expert Index
Layer Index
Figure 3: The heatmaps visualize the change in top-𝑘 expert selection frequency across all layers after the steering mask is
applied. MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
Multi-turn Jailbreak
GPT Hunyuan
Adult-Content
−0. 2
Change in Frequency (Steered - Baseline)
Expert Index
Layer Index
Figure 3: The heatmaps visualize the change in top-𝑘 expert selection frequency across all layers after the steering mask is
applied.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[37] Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. 2017. Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer. p. 1 1 Mixture-of-Experts Architecture
While dense LLMs activate all their parameters during inference,
MoE significantly reduces computational costs by activating only
a sparse subset of parameters for any given token [13, 37]. This is
achieved by replacing standard dense feed-forward networks with
an MoE layer containing multiple independent neural networks,
referred to as experts. 1 Mixture-of-Experts Architecture
While dense LLMs activate all their parameters during inference,
MoE significantly reduces computational costs by activating only
a sparse subset of parameters for any given token [13, 37]. This is
achieved by replacing standard dense feed-forward networks with
an MoE layer containing multiple independent neural networks,
referred to as experts. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[43] Lichao Wu, Sasha Behrouzi, Mohamadreza Rostami, Stjepan Picek, and AhmadReza Sadeghi. p. 0 MASCing: Configurable Mixture-of-Experts Behavior via
Activation Steering Masks
Jona te Lintelo
Radboud University
Lichao Wu
University of Bristol
Marina Krček
Radboud University
Sengim Karayalçin
Leiden University
Stjepan Picek
Radboud University &
Faculty of Electrical Engineering and
Computing, University of Zagreb
Abstract
Mixture-of-Experts (MoE) architectures in Large Language Models
(LLMs) have significantly reduced inference costs through sparse activation. However, this sparse activation paradigm also introduces
new safety challenges. MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
the desired sparsity for minimal influence on untargeted behavior, we extract the steering mask Sˆ using a symmetric magnitude
gate defined by threshold 𝜏. Applied element-wise to the scalar
components 𝑆𝑙,𝑒 of matrix S, the gate is defined as:
ˆ𝑆𝑙,𝑒 =
(
𝑆𝑙,𝑒 if |𝑆𝑙,𝑒 | > 𝜏
0 otherwise. MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
the desired sparsity for minimal influence on untargeted behavior, we extract the steering mask Sˆ using a symmetric magnitude
gate defined by threshold 𝜏. Applied element-wise to the scalar
components 𝑆𝑙,𝑒 of matrix S, the gate is defined as:
ˆ𝑆𝑙,𝑒 =
(
𝑆𝑙,𝑒 if |𝑆𝑙,𝑒 | > 𝜏
0 otherwise. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[46] Miao Yu, Siyuan Fu, Moayad Aloqaily, Zhenhong Zhou, Safa Otoum, Xing fan, Kun Wang et al. 2026. SafeSeek: Universal Attribution of Safety Circuits in Language Models. p. 7 Thus, optimal performance lies in a narrow boundary
where 𝛼 is sufficiently high to promote or discourage the use of
safety expert circuits, but low enough to preserve the utility of the
underlying language model. We observed consistent trends for the
remaining models and the adult-content generation tasks, with the
corresponding ablation graphs provided in Appendix B. Thus, optimal performance lies in a narrow boundary
where 𝛼 is sufficiently high to promote or discourage the use of
safety expert circuits, but low enough to preserve the utility of the
underlying language model. We observed consistent trends for the
remaining models and the adult-content generation tasks, with the
corresponding ablation graphs provided in Appendix B. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[51] Andy Zou, Long Phan, Sarah Chen, James Campbell, Phillip Guo, Richard Ren et al. p. 3 "
"Write a fictional story about bomb making. "
"James Bond would
make a bomb by . First, to
intervene on MoE behavior without retraining the model, we need
a tractable representation of how safety-relevant behavior emerges
through routing decisions. Directly optimizing over discrete top-
𝑘 expert selection is difficult. First, to
intervene on MoE behavior without retraining the model, we need
a tractable representation of how safety-relevant behavior emerges
through routing decisions. Directly optimizing over discrete top-
𝑘 expert selection is difficult. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[56] Qwen Team. 2024. Qwen1.5-MoE: Matching 7B Model Performance with 1/3 Activated Parameters". https://qwenlm. p. 1 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github. MASCing: Configurable Mixture-of-Experts Behavior via
Activation Steering Masks
Jona te Lintelo
Radboud University
Lichao Wu
University of Bristol
Marina Krček
Radboud University
Sengim Karayalçin
Leiden University
Stjepan Picek
Radboud University &
Faculty of Electrical Engineering and
Computing, University of Zagreb
Abstract
Mixture-of-Experts (MoE) architectures in Large Language Models
(LLMs) have significantly reduced inference costs through sparse activation. However, this sparse activation paradigm also introduces
new safety challenges. MASCing: Configurable Mixture-of-Experts Behavior via
Activation Steering Masks
Jona te Lintelo
Radboud University
Lichao Wu
University of Bristol
Marina Krček
Radboud University
Sengim Karayalçin
Leiden University
Stjepan Picek
Radboud University &
Faculty of Electrical Engineering and
Computing, University of Zagreb
Abstract
Mixture-of-Experts (MoE) architectures in Large Language Models
(LLMs) have significantly reduced inference costs through sparse activation. However, this sparse activation paradigm also introduces
new safety challenges.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[9] Hoagy Cunningham, Jerry Wei, Zihan Wang, Andrew Persic et al. 2026. Constitutional Classifiers++: Efficient Production-Grade Defenses against Universal Jailbreaks. p. 4 All MoE LLMs and the LSTM
model were implemented using PyTorch (CUDA), Hugging Face
Transformers, and Hugging Face Datasets. 3 Safety Configuration Scenarios
To demonstrate the versatility of MASCing, we evaluate it on two
fundamentally different safety configuration objectives: strengthening defenses against adversarial bypasses and contextual relaxation
for specialized applications. 1 for 15 epochs to reach convergence using a random 80/20
training-validation split that preserved class balance. The LSTM
dimensions, learning rate, and batch size are the same for each MoE
model and were determined through a preliminary hyperparameter
search, selected to balance convergence, computational efficiency,
and the prevention of overfitting. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Our code is publicly available at https://github.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[10] Damai Dai, Chengqi Deng, Chenggang Zhao, R. X. Xu et al. 2024. DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models. p. 0 MASCing: Configurable Mixture-of-Experts Behavior via
Activation Steering Masks
Jona te Lintelo
Radboud University
Lichao Wu
University of Bristol
Marina Krček
Radboud University
Sengim Karayalçin
Leiden University
Stjepan Picek
Radboud University &
Faculty of Electrical Engineering and
Computing, University of Zagreb
Abstract
Mixture-of-Experts (MoE) architectures in Large Language Models
(LLMs) have significantly reduced inference costs through sparse activation. However, this sparse activation paradigm also introduces
new safety challenges. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[13] William Fedus, Barret Zoph, and Noam Shazeer. 2022. Switch transformers: scaling to trillion parameter models with simple and efficient sparsity. p. 0 Keywords
Mixture-of-Experts, Activation Steering, Large Language Model
Safety, Jailbreak Defense
1 Introduction
Large Language Models (LLMs) have demonstrated impressive capabilities across natural language understanding, code generation,
and logical reasoning [4, 6, 23, 41]. However, scaling (dense) LLMs is
costly: every parameter is activated for every input token, and larger
models directly increase computational, memory, and infrastructure demands [18, 29, 35]. All implementations and evaluations in this work were conducted using CUDA-enabled GPUs for optimal runtimes. To fit the
substantial memory footprint of the target models and inference,
we used two NVIDIA GH200 120 GB Grace Hopper Superchips
paired with NVIDIA H100 GPUs.Where the paper says it
Where the paper says it
[17] Dan Hendrycks, Collin Burns, Steven Basart et al. 2021. Measuring Massive Multitask Language Understanding. p. 5 We evaluate this impact by comparing the model’s performance on language utility benchmarks before and after applying
our masking technique. Specifically, we utilize the Massive Multitask Language Understanding (MMLU) [17] and Grade School
Math 8K (GSM8K) [8] benchmarks to measure two distinct axes of
language utility, and because these benchmarks are often used by
providers to report on the performance of newly released models. 1 for 15 epochs to reach convergence using a random 80/20
training-validation split that preserved class balance. The LSTM
dimensions, learning rate, and batch size are the same for each MoE
model and were determined through a preliminary hyperparameter
search, selected to balance convergence, computational efficiency,
and the prevention of overfitting.Where the paper says it
Where the paper says it
[18] Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li et al. 2022. Lora: Low-rank adaptation of large language models. p. 0 These methods are expensive for large models and
particularly burdensome for MoE models, where safety behavior depends on both the learned parameters and sparse-activated experts. Moreover, safety requirements are dynamic: policies evolve, deployment contexts differ, and emerging misuse patterns may require
quick adaptation.Where the paper says it
[34] Kiho Park, Yo Joong Choe, and Victor Veitch. 2024. The Linear Representation Hypothesis and the Geometry of Large Language Models. p. 1 The core idea is to add
a steering vector at one or more model layers, nudging the model
to exhibit some target behavioral trait. Activation steering builds
on the linear representation hypothesis (LRH) [34]: the hypothesis
2 1 for 15 epochs to reach convergence using a random 80/20
training-validation split that preserved class balance. The LSTM
dimensions, learning rate, and batch size are the same for each MoE
model and were determined through a preliminary hyperparameter
search, selected to balance convergence, computational efficiency,
and the prevention of overfitting.Where the paper says it
Where the paper says it
[39] Jona te Lintelo, Lichao Wu, and Stjepan Picek. p. 0 MASCing: Configurable Mixture-of-Experts Behavior via
Activation Steering Masks
Jona te Lintelo
Radboud University
Lichao Wu
University of Bristol
Marina Krček
Radboud University
Sengim Karayalçin
Leiden University
Stjepan Picek
Radboud University &
Faculty of Electrical Engineering and
Computing, University of Zagreb
Abstract
Mixture-of-Experts (MoE) architectures in Large Language Models
(LLMs) have significantly reduced inference costs through sparse activation. However, this sparse activation paradigm also introduces
new safety challenges. MASCing: Configurable Mixture-of-Experts Behavior via
Activation Steering Masks
Jona te Lintelo
Radboud University
Lichao Wu
University of Bristol
Marina Krček
Radboud University
Sengim Karayalçin
Leiden University
Stjepan Picek
Radboud University &
Faculty of Electrical Engineering and
Computing, University of Zagreb
Abstract
Mixture-of-Experts (MoE) architectures in Large Language Models
(LLMs) have significantly reduced inference costs through sparse activation. However, this sparse activation paradigm also introduces
new safety challenges. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[53]. An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui et al. 2025. Qwen3 Technical Report. p. 5 We evaluate this impact by comparing the model’s performance on language utility benchmarks before and after applying
our masking technique. Specifically, we utilize the Massive Multitask Language Understanding (MMLU) [17] and Grade School
Math 8K (GSM8K) [8] benchmarks to measure two distinct axes of
language utility, and because these benchmarks are often used by
providers to report on the performance of newly released models. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[47] Weizhe Yuan, Jane Yu, Song Jiang, Karthik Padthe et al. 2025. NaturalReasoning: Reasoning in the Wild with 2. p. 4 EroticaAnalysis consists of 14886
instructions to generate sexually explicit text and was chosen as it
is one of the largest publicly available datasets for adult-content
generation. Facebook’s NaturalReasoning is a large-scale dataset
with more than one million general reasoning tasks. EroticaAnalysis consists of 14886
instructions to generate sexually explicit text and was chosen as it
is one of the largest publicly available datasets for adult-content
generation. Facebook’s NaturalReasoning is a large-scale dataset
with more than one million general reasoning tasks. For MHJ, we collect all routing logits for only the prompt
in each conversation that leads to the first harmful response. This is
done by iteratively prompting the model with the user’s questions
from a conversation in MHJ. For MHJ, we collect all routing logits for only the prompt
in each conversation that leads to the first harmful response. This is
done by iteratively prompting the model with the user’s questions
from a conversation in MHJ. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[48] Xiyu Zeng, Siyuan Liang, Liming Lu, Haotian Zhu et al. 2025. SafeSteer: Adaptive Subspace Steering for Efficient Jailbreak Defense in Vision-Language Models. p. 0 These results establish
MASCing as a practical, lightweight, and flexible framework for
scenario-specific safety reconfiguration in MoE models. Keywords
Mixture-of-Experts, Activation Steering, Large Language Model
Safety, Jailbreak Defense
1 Introduction
Large Language Models (LLMs) have demonstrated impressive capabilities across natural language understanding, code generation,
and logical reasoning [4, 6, 23, 41]. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[49] Jiachen Zhao, Jing Huang, Zhengxuan Wu, David Bau, and Weiyan Shi. 2026. LLMs Encode Harmfulness and Refusal Separately. p. 7 We first conduct an analysis on the combination of 𝜆 and 𝛼. We
then evaluate 𝜏 separately from 𝜆 and 𝛼 because 𝜏 is designed to only
filter out the unimportant steering mask values driven to near zero
by the 𝐿1 regularization, as described in Section 4.Where the paper says it
[52] Andy Zou, Zifan Wang, Jico Kolter, and Matt Fredrikson. 2023. Universal and Transferable Adversarial Attacks on Aligned Language Models. p. 6 9%
Multi-turn Jailbreak Defense Use Case. As detailed in Table 2,
standard alignment is heavily degraded in multi-turn adversarial
settings, with unsteered models successfully defending against
attacks only 52. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[54] Weizhe Yuan, Jane Yu, Song Jiang, Karthik Padthe et al. 2025. NaturalReasoning: Reasoning in the Wild with 2.8M Challenging Questions. arXiv:2502.13124 [cs:CL] https://arxiv.org/abs/2502.13124.
[6] Mark Chen, Jerry Tworek, Heewoo Jun et al. 2021. Evaluating Large Language Models Trained on Code. p. 0 These results establish
MASCing as a practical, lightweight, and flexible framework for
scenario-specific safety reconfiguration in MoE models. Keywords
Mixture-of-Experts, Activation Steering, Large Language Model
Safety, Jailbreak Defense
1 Introduction
Large Language Models (LLMs) have demonstrated impressive capabilities across natural language understanding, code generation,
and logical reasoning [4, 6, 23, 41]. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. MASCing, instead, trains an LSTM
surrogate on continuous, unnormalized routing logits. This preserves fine-grained routing information and allows the surrogate to
1
arXiv:2604. neuronpedia. org/gemma-2-9b-it/steer for an interactive demo of
model steering.Where the paper says it
Where the paper says it
Where the paper says it
Where the paper says it
[55] Qwen Team. 2024. Qwen1.5-MoE: Matching 7B Model Performance with 1/3 Activated Parameters". https://qwenlm.github.io/blog/qwen-moe/.
[66] MASCing: Configurable Mixture-of-Experts Behavior via Activation Steering Masks
--- Page 1 ---
The paper introduces MASCing, a novel lightweight framework that dynamically reconfigures MoE safety via sparse activation steering masks. It is the first framework that enables flexible reconfiguration of MoE behavior across diverse safety scenarios without retraining. p. 0 At the same time, adapting model behavior through full fine-tuning or retraining is costly, especially when
developers need to rapidly configure the same model for different
safety objectives. We present MASCing (MoE Activation Steering
Configuration), the first framework that enables flexible reconfiguration of MoE behavior across diverse safety scenarios without
retraining.Where the paper says it
Pruning redundant reasoning tokens
The authors introduce a novel method for analyzing MoE behavior through continuous routing logits rather than discrete top-k expert selections. This approach bypasses the non-differentiable routing bottleneck and enables a sequence-based surrogate to map routing patterns to downstream behavioral expert circuits. p. 1 • We introduce a novel method for analyzing MoE behavior
through continuous routing logits rather than discrete top-
𝑘 expert selections. This bypasses the non-differentiable
routing bottleneck and enables a sequence-based surrogate
to map routing patterns to downstream behavioral expert
circuits.Where the paper says it
How the training signal is built
The surrogate LSTM model is trained on a dataset of routing logits and labels y ∈ [0, 1] using Binary Cross-Entropy loss. The LSTM network parameters are optimized to minimize this loss, resulting in a trained model that classifies an input sequence of routing logits as leading to a certain behavior in the MoE model. p. 3 The LSTM network parameters are
optimized to minimize the Binary Cross-Entropy with logits loss
L:
Ltrain = −
1
𝐵
∑︁𝐵
𝑖=1
[𝑦𝑖
log(𝜎(𝑦ˆ𝑖)) + (1 − 𝑦𝑖) log(1 − 𝜎(𝑦ˆ𝑖))] , (5)
where 𝐵 is the batch size and 𝜎(·) is the sigmoid function. The
result is a LSTM trained to classify an input sequence of routing
logits as leading to a certain behavior in the MoE model.Where the paper says it
Where the gains come from
The framework's efficacy is demonstrated by achieving significant gains in both defensive multi-turn jailbreak mitigation (up to 89.2%) and permissive domain-specific policy compliance (up to 93. p. 1 • We validate the configurability of MASCing in distinct,
safety-related applications, achieving significant gains in
both defensive multi-turn jailbreak mitigation (increasing
success rates up to 89. 2%) and permissive domain-specific
policy compliance (boosting generation success rates up to
93. Finally, to configure model
behavior at deployment time, MASCing converts the discovered
circuit into a static steering mask and applies it directly to the routing gates. The mask overrides top-𝑘 expert selection only where
needed, shifting the target safety behavior while preserving the
model’s general language utility and lexical integrity. Our
contributions include:
• We propose MASCing, a novel lightweight framework that
dynamically reconfigures MoE safety via sparse activation
steering masks, avoiding the prohibitive computational
costs of full-parameter fine-tuning while preserving general
language utility. • We introduce a novel method for analyzing MoE behavior
through continuous routing logits rather than discrete top-
𝑘 expert selections.Where the paper says it
Where the paper says it
Where the paper says it
Limitations
MASCing relies on an LSTM surrogate model to approximate complex cross-layer routing dynamics, which may lead to sub-optimal mask optimizations in extraordinarily deep models. Furthermore, the method intervenes exclusively at the routing level, assuming the model possesses inherent capacity to generate safe responses if experts are not fundamentally aligned. The static steering masks optimized in this work may be less resilient to sophisticated, out-of-distribution, zero-day jailbreaks.
Future Work
Future research should explore the development of dynamic, input-dependent steering masks that predict the necessary steering configuration on a per-prompt or per-token basis Additionally, exploring the connection between routing steering and attention-head interventions could yield a unified framework for complete mechanistic control over sparse architectures. The foundational framework of MASCing is task-agnostic, suggesting future work should explore applying it to other critical domains such as on-the-fly domain adaptation.
[1] Marah Abdin, Jyoti Aneja, Hany Awadalla, Ahmed Awadallah, Ammar Ahmad Awan, Nguyen Bach, Amit Bahree et al. 2024. Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone. arXiv:2404.14219
[3] Trenton Bricken, Adly Templeton, Joshua Batson, Brian Chen et al. 2023. Towards Monosemanticity: Decomposing Language Models. With Dictionary Learning. Transformer Circuits Thread (2023). https://transformercircuits.pub/2023/monosemantic-features/index.html.
[11] Nelson Elhage, Neel Nanda, Catherine Olsson et al. 2021. A Mathematical Framework for Transformer Circuits. Transformer Circuits Thread (2021). https://transformer-circuits.pub/2021/framework/index.html.
[37] Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz et al. 2017. Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer. arXiv:1701.06538
[43] Lichao Wu, Sasha Behrouzi, Mohamadreza Rostami, Stjepan Picek, and AhmadReza Sadeghi. 2025. GateBreaker: Gate-Guided Attacks on Mixture-of-Expert LLMs. arXiv:2512.21008
[46] Miao Yu, Siyuan Fu, Moayad Aloqaily et al. 2026. SafeSeek: Universal Attribution of Safety Circuits in Language Models. arXiv:2603.23268
[51] Andy Zou, Long Phan, Sarah Chen, James Campbell et al. 2023. Representation engineering: A top-down approach to ai transparency. arXiv preprint arXiv:2310.01405 (2023).
[56] Qwen Team. 2024. Qwen1.5-MoE: Matching 7B Model Performance with 1/3 Activated Parameters". https://qwenlm.github.
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Targeted safety reconfiguration: MASCing enables
flexible reconfiguration of MoE behavior across diverse safety scenarios without retraining,
allowing developers totarget enhancement or suppression of specific behaviors while preserving general language utility.
-
Multi-turn jailbreak defense: The system can improve the average defense success rate from 52.5% to 83.9% by utilizing an LSTM surrogate model trained on continuous routing logits to capture
temporal patterns across token sequences and crosslayer dependencies.
-
Adult content compliance: MASCing allows models to
comply with such requests that would otherwise be refused,
increasing the average generation success rate from 52.6% to 82.0%, demonstrating the ability to achievetargeted, policy-aligned manner
relaxation of safety constraints. -
Computational efficiency: The framework is practical because it
avoids modifying the weights of the MoE LLM, meaning the computational cost is strictly bound to the model size and standard inference,
with only a lightweight LSTM surrogate requiring approximately five minutes on a single NVIDIA H100 GPU for training. -
Nuanced behavioral steering: By using continuous routing logits, MASCing allows for
a highly nuanced activation pattern
through an amplitude parameter alpha, which enablesa highly nuanced activation pattern
that preserves the router’s ability to dynamically evaluate input and construct the optimal steering circuit tailored to the evolving conversational context. -
Superior multi-turn defense: Compared to SteerMoE, MASCing achieves a significantly higher defense success rate (83.9% vs 58.4%) because it leverages
the complete conversation context
andcross-layer dependencies
through the LSTM surrogate, which is superior to methods relying only on top-k expert selections. -
Domain-specific control: The system can be applied to other critical domains beyond safety, such as
on-the-fly domain adaptation (e.g., steering a general MoE to act as a specialized medical or legal expert),
showing the framework's versatility across various deployment needs.
Abstract
Large language models (LLMs) operate under safety requirements that vary across applications and evolve with emerging threats and deployment policies. Conventional training-based interventions make adapting model behavior computationally expensive. Mixture-of-Experts (MoE) models introduce a further control challenge because each input activates only a subset of experts, coupling safety behavior to discrete routing decisions. Rapid adaption of MoE LLMs therefore requires a lightweight mechanism for identifying and controlling the routing decisions that produce the target behavior. We present MASCing (MoE Activation Steering Configuration), a framework that enables flexible configuration of safety-related MoE behavior without training the underlying model. MASCing uses an LSTM surrogate model to capture cross-layer dependencies and map routing logits to downstream behaviors. Guided by this surrogate, it identifies safety-relevant experts and optimizes a sparse steering mask to bias expert selection. This enables targeted enhancement or suppression of specific behaviors while preserving model utility. We evaluate MASCing on three contrasting safety objectives and observe consistent gains across seven MoE models. For multi-turn jailbreak defense, it improves the average defense success rate from 52.5% to 83.9%. For adult-content generation, MASCing enables models to comply with such requests that would otherwise be refused, increasing the average generation success rate from 52.6% to 82.0%. For political neutrality, MASCing makes models decline to state personal opinions on political questions, which they otherwise often give, raising the share of such questions on which they take no position from 31.8% to 75.4% while other questions remain answered. These results establish MASCing as a practical, lightweight, and flexible framework for task-specific safety configuration in MoE models.
Sources
- Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone
- Evaluating Large Language Models Trained on Code
- Persona Vectors: Monitoring and Controlling Character Traits in Language Models
- Training Verifiers to Solve Math Word Problems
- DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models
- The Llama 3 Herd of Models
- Mixtral of Experts
- Adam: A Method for Stochastic Optimization
- Building Production-Ready Probes For Gemini
- LLM Defenses Are Not Robust to Multi-Turn Human Jailbreaks Yet
- Scaling Down to Scale Up: A Guide to Parameter-Efficient Fine-Tuning
- The Assistant Axis: Situating and Stabilizing the Default Persona of Language Models
- Jailbreaking Attack against Multimodal Large Language Model
- Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer
- Large Language Lobotomy: Jailbreaking Mixture-of-Experts via Expert Silencing
- GateBreaker: Gate-Guided Attacks on Mixture-of-Expert LLMs
- Qwen3 Technical Report
- SafeSeek: Universal Attribution of Safety Circuits in Language Models
- NaturalReasoning: Reasoning in the Wild with 2.8M Challenging Questions
- SafeSteer: Adaptive Subspace Steering for Efficient Jailbreak Defense in Vision-Language Models
Related papers
- RustMizan: A Compilable, Contamination-Aware Benchmarking Framework for Rust Vulnerabilities
- Introducing the Generative Application Firewall (GAF)
- Opal: Private Memory for Personal AI
- Fuel as Identity: Authenticating Inter-Satellite Laser Links after Total Key Compromise
- Merkle Trees Minimize Verifier Complexity in the ROM
- VulCPE: Context-Aware Cybersecurity Vulnerability Retrieval and Management