Energy-efficient network intrusion detection using spiking neural networks for tactical and edge deployment.
NeuroIDS achieves 73.4% accuracy on the NSL-KDD benchmark while consuming only 1,620 pJ per inferenceβapproximately 10,000x more energy-efficient than equivalent deep learning approaches. Unlike previous SNN-based IDS implementations that failed on minority attack classes, NeuroIDS successfully detects all five traffic categories including the challenging R2L and U2R attacks.
| Attack Category | Recall | Support | Notes |
|---|---|---|---|
| Normal | 87.9% | 9,711 | Low false positive rate |
| DoS | 67.4% | 7,458 | Denial of Service attacks |
| Probe | 82.9% | 2,421 | Reconnaissance/scanning |
| R2L | 33.7% | 2,887 | Remote to Local attacks |
| U2R | 69.2% | 67 | User to Root privilege escalation |
Overall Accuracy: 73.4% | Energy: 1,620 pJ/inference | All 5 classes detected
| Metric | Baseline SNN | NeuroIDS v4 |
|---|---|---|
| Accuracy | 63.0% | 73.4% |
| Classes Detected | 2/5 | 5/5 |
| Probe Recall | 0% | 82.9% |
| R2L Recall | 0% | 33.7% |
| U2R Recall | 0% | 69.2% |
This is the first paper in the NeuroIDS series:
| Paper | Description | Link |
|---|---|---|
| NeuroIDS | Terrestrial SNN-based IDS (this repo) | DOI: 10.13140/RG.2.2.23827.13604 |
| NeuroIDS-Sat | Space-adapted variant for CubeSat constellations with TMR radiation tolerance | DOI: 10.13140/RG.2.2.16893.42724 |
| NeuroIDS-Adversarial | Adversarial robustness analysis and defensive hardening | GitHub |
# Clone the repository
git clone https://github.com/SephDavis/NeuroIDS.git
cd NeuroIDS
# Install dependencies
pip install -r requirements.txt- Download from UNB NSL-KDD
- Place
KDDTrain+.txtandKDDTest+.txtindata/NSL-KDD/
python examples/train_nslkdd.pyfrom src.neuroids_v4 import NeuroIDS
# Load pre-trained model
model = NeuroIDS.load('models/pretrained/nslkdd_model_v4.pkl')
# Predict on new data (normalized features, shape: [n_samples, 41])
predictions = model.predict(X_test)
# Get probabilities
probabilities = model.predict_proba(X_test)
# Evaluate
metrics = model.evaluate(X_test, y_test)
print(f"Accuracy: {metrics['accuracy']:.4f}")NeuroIDS/
βββ src/
β βββ neuroids_v4.py # Main SNN implementation (USE THIS)
β βββ data_augmentation.py # SMOTE and class balancing
β βββ data.py # Data loading utilities
β βββ neurons.py # LIF neuron models
β βββ encoders.py # Spike encoding schemes
β βββ layers.py # SNN layer implementations
β βββ utils.py # Helper functions
βββ examples/
β βββ train_nslkdd.py # Full training script
β βββ quick_start.py # Basic usage example
β βββ energy_analysis.py # Energy efficiency evaluation
βββ models/
β βββ pretrained/
β βββ nslkdd_model_v4.pkl
βββ data/
β βββ NSL-KDD/ # Place dataset here
βββ docs/
β βββ NeuroIDS_Paper.pdf # IEEE paper
βββ tests/
β βββ test_network.py
βββ requirements.txt
βββ README.md
NeuroIDS uses a feedforward spiking neural network with Leaky Integrate-and-Fire (LIF) neurons:
Input (41 features) β Spike Encoding β Hidden Layer (128 LIF) β Hidden Layer (64 LIF) β Output (5 classes)
-
Spike Count-Based Classification: Instead of backpropagating through non-differentiable spikes, we use accumulated spike counts as continuous features for the output layer. This enables stable gradient-based learning.
-
Adaptive Class Scaling: Dynamically adjusts class weights during training to prevent collapse to majority classesβcritical for detecting rare attacks like U2R (only 52 training samples).
-
Balanced Sampling: Undersamples majority classes and oversamples minority classes to create balanced training batches without expensive synthetic data generation.
V(t+1) = V_rest + (V(t) - V_rest) Γ exp(-Ξt/Ο_m) + R_m Γ I(t)
If V(t) β₯ V_thresh: spike and reset to V_reset
| Parameter | Value |
|---|---|
| Membrane time constant (Ο_m) | 15.0 ms |
| Threshold (V_thresh) | 0.5 |
| Reset potential (V_reset) | 0.0 |
| Refractory period | 2.0 ms |
NeuroIDS is designed for deployment on neuromorphic hardware where energy efficiency is critical:
| Metric | Value |
|---|---|
| Average spikes per inference | 810 |
| Energy per spike (neuromorphic HW) | ~2 pJ |
| Total SNN energy | 1,620 pJ |
| Equivalent ANN energy | ~68.8 mJ |
| Efficiency gain | ~10,000-42,000Γ |
At 1,620 pJ per inference, NeuroIDS can process ~600,000 samples/second/milliwatt, enabling:
- Battery-powered edge deployment
- Always-on monitoring in power-constrained environments
- Deployment on neuromorphic chips (BrainChip Akida, Intel Loihi)
from src.neuroids_v4 import NeuroIDS, NetworkConfig, create_ids_network
from src.data import DataLoader, normalize_features
# Load data
loader = DataLoader('data/NSL-KDD')
X_train, y_train = loader.load_train()
X_test, y_test = loader.load_test()
# Normalize
X_train, stats = normalize_features(X_train)
X_test, _ = normalize_features(X_test, stats=stats)
# Create model
model = create_ids_network('standard') # or 'lightweight', 'deep', 'accurate'
# Train
history = model.fit(
X_train, y_train,
epochs=20,
validation_data=(X_test, y_test),
patience=5,
verbose=True
)
# Save
model.save('my_model.pkl')from src.neuroids_v4 import NeuroIDS, NetworkConfig
config = NetworkConfig(
input_size=41,
hidden_sizes=[256, 128, 64], # Deeper network
output_size=5,
time_steps=150, # Longer simulation
v_thresh=0.5,
tau_m=15.0,
spike_rate=0.3,
learning_rate=0.01,
weight_decay=0.0001
)
model = NeuroIDS(config)from src.data_augmentation import balance_dataset, AugmentationConfig
# Balance training data
aug_config = AugmentationConfig(
min_samples_per_class=2000,
target_ratio=0.6,
smote_k_neighbors=5
)
X_balanced, y_balanced = balance_dataset(X_train, y_train, aug_config)
# Train on balanced data
model.fit(X_balanced, y_balanced, ...)To reproduce the results from the paper:
# Full training with synthetic validation + NSL-KDD
python examples/train_nslkdd.pyExpected output:
Overall Accuracy: 0.7342
normal: P=0.711 R=0.879 F1=0.786
dos: P=0.900 R=0.674 F1=0.771
probe: P=0.644 R=0.829 F1=0.725
r2l: P=0.645 R=0.337 F1=0.443
u2r: P=0.106 R=0.692 F1=0.184
- Forward operating bases with limited power
- Unmanned systems (drones, UGVs)
- Satellite communication endpoints
- Smart grid monitoring
- Industrial control systems
- Connected vehicle networks
- Remote sensors
- Battery-powered devices
- Embedded security appliances
- Hardware validation on BrainChip Akida
- Intel Loihi deployment
- STDP-based unsupervised pre-training
- Temporal/latency encoding schemes
- Evaluation on CICIDS2017/2018 datasets
-
Adversarial robustness analysisβ NeuroIDS-Adversarial
If you use NeuroIDS in your research, please cite:
@article{davis2026neuroids,
title={NeuroIDS: Energy-Efficient Intrusion Detection Using Spiking Neural
Networks for Tactical Network Defense},
author={Davis, Toby R.},
doi={10.13140/RG.2.2.23827.13604},
year={2026}
}This project is licensed under the MIT License - see the LICENSE file for details.
- Department of Defense Cyber Service Academy Scholarship Program
- Mississippi State University Department of Computer Science and Engineering
- NSL-KDD dataset creators at the University of New Brunswick
Toby R. Davis M.S. Candidate, Cybersecurity & Operations Mississippi State University Email: trd183@msstate.edu GitHub: @SephDavis
NeuroIDS β Bringing neuromorphic computing to cybersecurity π§ π
