Skip to main content

Framework for Single Event Upset (SEU) injection in neural networks for harsh environment applications

Project description

SEU Injection Framework

PyPI version Python versions License: MIT Tests Coverage

A Python framework for Single Event Upset (SEU) injection in neural networks for robustness analysis in harsh environments.

📖 Documentation | 🚀 Quick Start | 🔬 Research Paper

Installation

Option 1: Install from PyPI (Recommended)

# 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: Install from 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 Support (Optional):

If you need CUDA-enabled PyTorch, install it first:

# 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 for troubleshooting.

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%}")

💡 Need a full tutorial? See docs/quickstart.md for a complete 10-minute walkthrough.

📚 Complete Examples

Features

  • Works with Any PyTorch Model: Drop-in compatibility with standard PyTorch models - no modifications required
  • Built for Research: Designed for reliability analysis in space systems, nuclear environments, and harsh conditions
  • High-Performance: Optimized bit manipulation operations (10-100x faster than naive implementations)
  • Multiple Injection Methods: Systematic bit-by-bit analysis for small models, stochastic sampling for large-scale campaigns
  • GPU Accelerated: Full CUDA support for efficient fault injection on neural networks of any size

🤝 Contributing & Support

📝 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.8}
}

@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

seu_injection_framework-1.1.8.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seu_injection_framework-1.1.8-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file seu_injection_framework-1.1.8.tar.gz.

File metadata

  • Download URL: seu_injection_framework-1.1.8.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

Hashes for seu_injection_framework-1.1.8.tar.gz
Algorithm Hash digest
SHA256 9931c8f03779ab2c0c8f6f16cf47b4fa83d24f5abfd5ac732a5d37bafd60317a
MD5 b4b0858f2937a9d4d631a81120cab502
BLAKE2b-256 95b23c663fd3bdcd56cb8796cdba178dd17e24659bd85441392f86dcbdf97a82

See more details on using hashes here.

Provenance

The following attestation bundles were made for seu_injection_framework-1.1.8.tar.gz:

Publisher: release.yml on wd7512/seu-injection-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file seu_injection_framework-1.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for seu_injection_framework-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 79f62fc178c773c0f2905c520105665ee64fa21736746c741800b299948fee57
MD5 9cad5be5f1a2d8fe46c283a28d9d7c9b
BLAKE2b-256 2a1df91c9b0e1ccfa6d0e2b365e4caa598f7cfbd809f3cbfdfde9bd53d6317d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for seu_injection_framework-1.1.8-py3-none-any.whl:

Publisher: release.yml on wd7512/seu-injection-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page