Framework for Single Event Upset (SEU) injection in neural networks for harsh environment applications
Project description
SEU Injection Framework
A Python framework for Single Event Upset (SEU) injection in neural networks for robustness analysis in harsh environments.
Installation
Option 1 (recommended): PyPI
# Minimal core dependencies (PyTorch, NumPy, SciPy, tqdm)
pip install seu-injection-framework
# With analysis tools (scikit-learn, pandas, matplotlib, seaborn)
pip install "seu-injection-framework[analysis]"
# Everything (development, notebooks, vision models, docs)
pip install "seu-injection-framework[all]"
Option 2: Source (development)
git clone https://github.com/wd7512/seu-injection-framework.git
cd seu-injection-framework
# Using uv (recommended for development)
uv sync --extra dev --extra analysis --extra vision --extra notebooks
# Or using pip
pip install -e ".[all]"
GPU (optional): install a CUDA-enabled PyTorch first if required:
# Example for CUDA 12.x (adjust for your system)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
pip install seu-injection-framework
Verify installation:
python -c "from seu_injection import SEUInjector; print('Ready')"
Having issues? See docs/installation.md.
Quick example
import torch
from seu_injection import SEUInjector
from seu_injection.metrics import classification_accuracy
# Create a simple model and test data
model = torch.nn.Sequential(
torch.nn.Linear(10, 64),
torch.nn.ReLU(),
torch.nn.Linear(64, 2)
)
x_test = torch.randn(100, 10)
y_test = torch.randint(0, 2, (100,))
# Initialize SEU injector
injector = SEUInjector(
trained_model=model,
criterion=classification_accuracy,
x=x_test,
y=y_test
)
# Check baseline performance
print(f"Baseline accuracy: {injector.baseline_score:.2%}")
# Inject bit flips into sign bits (bit position 0)
results = injector.run_seu(bit_i=0)
print(f"Performed {len(results['criterion_score'])} injections")
# Sample some results
fault_impacts = [injector.baseline_score - score for score in results['criterion_score']]
print(f"Average accuracy drop: {sum(fault_impacts)/len(fault_impacts):.1%}")
Full tutorial: docs/quickstart.md.
Examples
- Basic CNN robustness:
examples/basic_cnn_robustness.py - Architecture comparison:
examples/architecture_comparison.py - Interactive notebook:
examples/Example_Attack_Notebook.ipynb
Features
- Works with standard PyTorch models (no code changes required)
- Suitable for reliability studies in harsh environments (space, nuclear, radiation)
- Optimized bit operations (10–100× faster than naive Python)
- Multiple injection modes: systematic per-bit or stochastic sampling
- Optional CUDA acceleration
Contributing & support
- Documentation:
docs/ - Contributing:
CONTRIBUTING.md - Issues: GitHub Issues
- Contact: wwdennis.home@gmail.com
Citation
If you use this framework in your research, please cite both the software and the research paper:
@software{seu_injection_framework,
author = {William Dennis},
title = {SEU Injection Framework},
year = {2025},
url = {https://github.com/wd7512/seu-injection-framework},
version = {1.1.9}
}
@conference{icaart25,
author = {William Dennis and James Pope},
title = {A Framework for Developing Robust Machine Learning Models in Harsh Environments: A Review of CNN Design Choices},
booktitle = {Proceedings of the 17th International Conference on Agents and Artificial Intelligence - Volume 2: ICAART},
year = {2025},
pages = {322-333},
publisher = {SciTePress},
organization = {INSTICC},
doi = {10.5220/0013155000003890},
isbn = {978-989-758-737-5},
issn = {2184-433X}
}
License
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for the research community studying neural network robustness in harsh environments.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seu_injection_framework-1.1.9.tar.gz.
File metadata
- Download URL: seu_injection_framework-1.1.9.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9586693c636d0a545f225c34b5219e5a89ba064f260d43a50568e60cea7f5d3
|
|
| MD5 |
836eaa47a436939d313d5c75c1e7cc71
|
|
| BLAKE2b-256 |
9e611adff9b760fc34bced8e64f4491e2e008fb354d418bb9a46103f063f4815
|
Provenance
The following attestation bundles were made for seu_injection_framework-1.1.9.tar.gz:
Publisher:
release.yml on wd7512/seu-injection-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
seu_injection_framework-1.1.9.tar.gz -
Subject digest:
c9586693c636d0a545f225c34b5219e5a89ba064f260d43a50568e60cea7f5d3 - Sigstore transparency entry: 699354542
- Sigstore integration time:
-
Permalink:
wd7512/seu-injection-framework@a8cb27fe6181700c2d845e62200a9905c6706200 -
Branch / Tag:
refs/tags/v1.1.9 - Owner: https://github.com/wd7512
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a8cb27fe6181700c2d845e62200a9905c6706200 -
Trigger Event:
push
-
Statement type:
File details
Details for the file seu_injection_framework-1.1.9-py3-none-any.whl.
File metadata
- Download URL: seu_injection_framework-1.1.9-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
812ef11b6c1aa5d80f22b4fc2b21a833a5b7e3f332e5e22dc9766b280341e15c
|
|
| MD5 |
1ada7424db76e3c5e67b3f7c4fbfae4d
|
|
| BLAKE2b-256 |
c1e8a34426068b10bfb2ac0bb660723ebdb8ed8700390e836132b5a8c9fef5d3
|
Provenance
The following attestation bundles were made for seu_injection_framework-1.1.9-py3-none-any.whl:
Publisher:
release.yml on wd7512/seu-injection-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
seu_injection_framework-1.1.9-py3-none-any.whl -
Subject digest:
812ef11b6c1aa5d80f22b4fc2b21a833a5b7e3f332e5e22dc9766b280341e15c - Sigstore transparency entry: 699354543
- Sigstore integration time:
-
Permalink:
wd7512/seu-injection-framework@a8cb27fe6181700c2d845e62200a9905c6706200 -
Branch / Tag:
refs/tags/v1.1.9 - Owner: https://github.com/wd7512
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a8cb27fe6181700c2d845e62200a9905c6706200 -
Trigger Event:
push
-
Statement type: