SECNEURON: Reliable and Flexible Abuse Control in Local LLMs via Hybrid Neuron Encryption

Zhiqiang Wang, Haohua Du, Junyang Wang, Haifeng Sun, Kaiwen Guo, Haikuo Yu, Chao Liu, Xiang-Yang LiarXiv 2025 · DOI · arXiv

Introduction

As Large Language Models (LLMs) transition from centralized cloud environments to local deployments on private servers and personal devices, a significant security challenge emerges. In these "white-box" settings, traditional safety measures like system prompts and output filters are easily bypassed because users have full control over the model's runtime. SECNEURON introduces a novel framework for intrinsic, reliable, and flexible abuse control by encrypting specific "task-related" neurons. This approach allows developers to distribute a single model while dynamically enabling or disabling specific capabilities—such as coding, medical diagnosis, or storytelling—for different users through efficient, millisecond-level key exchanges.

Overview of SECNEURON's fine-grained access control across different deployment scenarios.

The Challenge of Local LLM Safety

Standard safety interventions often rely on external wrappers that are trivial to strip away in local environments. Alternatives like "unlearning" specific knowledge or creating task-specific fine-tuned versions are either irreversible or logistically burdensome, requiring the maintenance of numerous model variants. SECNEURON addresses this by treating the model's internal neurons as protected assets, ensuring that unauthorized capabilities are physically inaccessible without the correct cryptographic keys.

Methodology: The SECNEURON Architecture

SECNEURON's architecture is built on three core pillars designed to provide robust security without compromising the model's utility for authorized tasks.

The SECNEURON workflow: from model development and distribution to secure deployment and execution.

1. Neuron Selector

To prevent "collateral damage" to authorized functions, SECNEURON employs a penalty-based scoring mechanism. This tool identifies neurons that are critical for a specific target task (e.g., generating code) but have minimal impact on other general capabilities. By decoupling these logically related capabilities at the neuron level, the system can target specific functions for encryption with high precision.

2. Hybrid Encryption Framework

The framework utilizes a two-layer encryption strategy to balance security and performance:

  • Policy Layer (CP-ABE): Ciphertext-Policy Attribute-Based Encryption manages access control. Permissions (e.g., Role: Researcher) are embedded directly into the decryption keys.
  • Execution Layer (AES-CTR): Because CP-ABE is computationally expensive for millions of parameters, it is only used to protect AES master keys. The actual neuron weights are encrypted using AES-CTR (Counter Mode), which allows for high-speed, random-access decryption during model inference.

3. Adaptive Pruner

When a model is partially decrypted, the remaining encrypted neurons can introduce significant noise, potentially degrading the performance of authorized tasks. SECNEURON includes an adaptive pruner that uses a distribution-based detection mechanism to identify these "garbage" neurons—often characterized by uniform distributions or extreme outliers—and prunes them in real-time to maintain inference accuracy.

Key Insights and Results

SECNEURON's "intrinsic" safety model ensures that even with adversarial prompts, an LLM with encrypted "coding neurons" simply lacks the internal knowledge to generate functional code. This provides a "one-time" distribution advantage: developers transmit the encrypted model once, and subsequent permission changes require only tiny (byte-level) key updates.

Experimental evaluations across models like OPT, Gemma-2, and ViT demonstrate the framework's effectiveness:

  • Capability Suppression: Unauthorized task accuracy was reduced to below 25%, while authorized tasks experienced less than a 2% performance drop.
  • Abuse Mitigation: The success rate for generating malicious code dropped from 59% to 15%.
  • Data Privacy: PII extraction rates were kept below 5%, and Membership Inference Attacks (MIA) were reduced to the level of random guessing (~50% AUROC).
  • Efficiency: Key generation and transmission overhead are minimal, occurring in milliseconds and at the byte level, respectively.

Limitations and Future Directions

While SECNEURON is highly effective for distinct tasks, it faces challenges with "highly analogous" domains, such as separating Python from Java coding, due to significant overlap in underlying logic neurons. Additionally, there is a theoretical limit to how many tasks can be isolated within a single model before neuron overlap becomes problematic. Future work will focus on automating hyperparameter selection and exploring the upper bounds of task isolation capacity.

Summary updated

BibTeX
@misc{wang2025secneuron,
  author = {Zhiqiang Wang and Haohua Du and Junyang Wang and Haifeng Sun and Kaiwen Guo and Haikuo Yu and Chao Liu and Xiang-Yang Li},
  title = {{SECNEURON: Reliable and Flexible Abuse Control in Local LLMs via Hybrid Neuron Encryption}},
  year = {2025},
  eprint = {2506.05242},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.05242},
}
Figure