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.
翻译:暂无翻译