Skip to main content

A framework for reproducible hardware fault-injection experiments on PyTorch models

Project description

FaultForge

A framework for running reproducible hardware fault-injection experiments on PyTorch models - with error-corrected memory reliability testing built in as its first experiment.

[!NOTE] main is the active development branch. For the latest release, see the latest branch.

Highlights

  • A reusable experiment framework (Experiment): automatic run loops, statistical stop conditions (run until a stable mean, a fixed count, or Ctrl+C), and atomic, resumable, optionally zstd-compressed saving.
  • Fingerprint-based verification: resuming or comparing a saved result against a changed configuration fails loudly with a precise diff, instead of silently mixing incompatible data.
  • A composable encoding framework (Encoder/Encoding, chainable via EncoderSequence) with three built-in ECC-style techniques - SECDED (Hamming codes), MSET, and CEP - usable standalone or combined.
  • An explicit fault model (bit flips and stuck-at faults) with a resumable, repeat-free fault-location sampler, and a batched injection API built for performance.
  • One ready-made experiment today, encoded_memory: fault injection into ECC-protected model parameters, with built-in CIFAR-10/100 and ImageNet model/dataset loading and a CLI for recording and plotting results. It doubles as the reference implementation to follow when adding a new experiment.
  • Performance-critical bit-buffer, encoding, and fault-injection logic is implemented in Rust and exposed to Python via PyO3.

Installation

FaultForge is split into two packages:

pip install faultforge        # library only
pip install faultforge-cli    # adds the `faultforge` CLI command

Building from source requires a Rust toolchain, since the library's performance-critical parts are a PyO3 extension compiled with maturin. Install one with your system package manager or via rustup. No toolchain is needed when installing a prebuilt wheel from PyPI.

Installing from source

Both packages live in this repository, under packages/faultforge and packages/faultforge_cli. Point pip at a subdirectory of whichever revision you want:

# latest (main is kept in sync with the newest code going forward)
pip install 'faultforge @ git+https://github.com/rezzubs/faultforge.git#subdirectory=packages/faultforge'

# latest release (the latest branch tracks the most recent tagged release)
pip install 'faultforge @ git+https://github.com/rezzubs/faultforge.git@latest#subdirectory=packages/faultforge'

# a specific released version
pip install 'faultforge @ git+https://github.com/rezzubs/faultforge.git@v0.2.0#subdirectory=packages/faultforge'

# a specific commit
pip install 'faultforge @ git+https://github.com/rezzubs/faultforge.git@<commit-sha>#subdirectory=packages/faultforge'

Substitute packages/faultforge_cli for packages/faultforge (and faultforge-cli for the package name before @) to install the CLI the same way.

FaultForge requires Python 3.14 or newer.

Quick example

from faultforge.encoding import SecdedEncoder
from faultforge.experiment import MaxRuns
from faultforge.experiments.encoded_memory import (
    EncodedFaultInjection,
    ReliabilityMetric,
)
from faultforge.loading import Cifar, CifarDataset, CifarModel

bundle = Cifar(model=CifarModel.ResNet20, dataset=CifarDataset.Cifar10)
encoder = SecdedEncoder(bits_per_chunk=64)

experiment = EncodedFaultInjection(
    bundle,
    encoder,
    ReliabilityMetric.Accuracy,
    faults=1e-3,  # a bit error rate; pass an int instead for an exact fault count
)
experiment.run_loop(stop_conditions=[MaxRuns(total=20)])

print("Mean accuracy:", experiment.mean_score())

See docs/library.md for a full walkthrough of the framework's pieces and how they compose.

Experiments

FaultForge ships one ready-made experiment today, built as the reference implementation for adding your own:

  • Encoded Memory - fault injection into ECC-protected model parameters, covering the available encoding techniques, the faultforge encoded-memory CLI, and using the experiment directly as a library.

Citation

Encoded Memory

There are two papers related to the encoded memory experiment.

Paper in DATE 2026

Introduced the MSET technique as a zero cost alternative to ECCs.

@inproceedings{ahmadilivani2026late,
  title={Late Breaking Results: Uncovering the Limits of ECCs in Vision Transformers and a Zero-Cost Reliability Enhancement},
  author={Ahmadilivani, Mohammad Hasan and Roots, Marten and Restifo, Marco and Loorits, Sven-Markus and Di Mauro, Luca and Raik, Jaan},
  booktitle={2026 Design, Automation \& Test in Europe Conference (DATE)},
  pages={1--3},
  year={2026},
  organization={IEEE},
  link={https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=11539549}
}

Paper in IOLTS 2026

Introduced the CEP technique:

@article{ahmadilivani2026effective,
  title={Effective and Memory-Efficient Alternatives to ECC for Reliable Large-Scale DNNs},
  author={Ahmadilivani, Mohammad Hasan and Roots, Marten and Restifo, Marco and Loorits, Sven-Markus and Di Mauro, Luca and Raik, Jaan},
  booktitle={The 32nd IEEE International Symposium on On-Line Testing and Robust System Design (IOLTS)},
  year={2026},
  organization={IEEE},
  link={arXiv preprint arXiv:2605.07417}
}

License

UPL-1.0

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

faultforge-0.2.1.tar.gz (79.7 kB view details)

Uploaded Source

Built Distributions

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

faultforge-0.2.1-cp314-cp314-win_amd64.whl (351.8 kB view details)

Uploaded CPython 3.14Windows x86-64

faultforge-0.2.1-cp314-cp314-manylinux_2_34_x86_64.whl (543.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

faultforge-0.2.1-cp314-cp314-manylinux_2_34_aarch64.whl (538.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

faultforge-0.2.1-cp314-cp314-macosx_11_0_arm64.whl (482.6 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

File details

Details for the file faultforge-0.2.1.tar.gz.

File metadata

  • Download URL: faultforge-0.2.1.tar.gz
  • Upload date:
  • Size: 79.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for faultforge-0.2.1.tar.gz
Algorithm Hash digest
SHA256 5c7a3fc61de3344a10e02e089df24ba59bdf5beee4627cc32613f1748a4b4e4b
MD5 80726574830bea26a7a52f952773d501
BLAKE2b-256 691f03c7bcc084a46524dfb23cf19d6cd7219798ed067e7c5fc657e8e73362c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for faultforge-0.2.1.tar.gz:

Publisher: release.yml on rezzubs/faultforge

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

File details

Details for the file faultforge-0.2.1-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: faultforge-0.2.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 351.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for faultforge-0.2.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 78ebbe075cfc3f8d5042b27191e1341d984fb69b955ea9486163d01727391b4e
MD5 9eb72f2c7dae1e26c6bbffe3870db21e
BLAKE2b-256 f21dbf5dc4848d28d092df1dd8bcb35dac7e9e8b7cca67c17cb10fe0fd424711

See more details on using hashes here.

Provenance

The following attestation bundles were made for faultforge-0.2.1-cp314-cp314-win_amd64.whl:

Publisher: release.yml on rezzubs/faultforge

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

File details

Details for the file faultforge-0.2.1-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for faultforge-0.2.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6d0ce13add26f2c5bf0bc1f1d50f6b9f48c652d402fa97f9d9a40439c1754759
MD5 8cbe74aa0903fd2bdf2d5d0580d28396
BLAKE2b-256 4adee703ea416fc865f5cae683206eef74dc4d494d3091b17db7aa6157ef3f31

See more details on using hashes here.

Provenance

The following attestation bundles were made for faultforge-0.2.1-cp314-cp314-manylinux_2_34_x86_64.whl:

Publisher: release.yml on rezzubs/faultforge

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

File details

Details for the file faultforge-0.2.1-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for faultforge-0.2.1-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9f88f6df64505087aa63bfc56ce72106cd7090550d4486837b17cd99269b2384
MD5 ab1318ce1d26b262c902447942f55c17
BLAKE2b-256 903b10776b3f3e3bf8a9d26ca686e7b9eb3da90ca9a65b53f47b0aa5969a248f

See more details on using hashes here.

Provenance

The following attestation bundles were made for faultforge-0.2.1-cp314-cp314-manylinux_2_34_aarch64.whl:

Publisher: release.yml on rezzubs/faultforge

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

File details

Details for the file faultforge-0.2.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for faultforge-0.2.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3bdf07b870f45133d45113710bdc04a5c408c42c78f1b3cc247962d641d4405f
MD5 55d97524c42941b81c44325155139f6e
BLAKE2b-256 8991d4a4d4ca1c883489c48574d851bdae9e8ee1fbf84d993e901ebe074e2cea

See more details on using hashes here.

Provenance

The following attestation bundles were made for faultforge-0.2.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on rezzubs/faultforge

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