Skip to main content

Verril-Learn 🧠✂️

A Surgical Machine Unlearning Library for Edge Devices

Python 3.8+ PyTorch License: MIT

🎯 What is Verril-Learn?

Verril-Learn is a novel machine unlearning library designed specifically for edge devices. It enables you to surgically remove the influence of specific data points from a trained model without full retraining.

Key Features

  • 🔬 Surgical Unlearning: Remove specific data influence using Fisher Information + Gradient Ascent
  • 🎭 Data Poisoning Simulation: Built-in tools to simulate and study data attacks
  • 📱 Edge-Device Optimized: Lightweight algorithms suitable for resource-constrained environments
  • 🔒 Privacy-Compliant: Implements concepts aligned with GDPR's "Right to be Forgotten"

📦 Installation

pip install -e .

Or install dependencies directly:

pip install -r requirements.txt

🚀 Quick Start

from verril_learn import get_poisoned_mnist, SimpleCNN, surgical_unlearn

# Step 1: Load poisoned MNIST (10% of '7's mislabeled as '1's)
train_loader, test_loader, poison_indices = get_poisoned_mnist(poison_ratio=0.1)

# Step 2: Train your model (standard PyTorch training loop)
model = SimpleCNN()
# ... train the model ...

# Step 3: Surgically unlearn the poisoned data
unlearned_model = surgical_unlearn(
    model=model,
    poisoned_data=poisoned_loader,
    retain_data=clean_loader,
    fisher_weight=0.1,
    unlearn_lr=0.001,
    unlearn_steps=10
)

🧪 The Algorithm

1. Fisher Information Matrix (Diagonal Approximation)

Identifies which weights are critical for the retain data:

F_ii = E[(∂L/∂θ_i)²]

2. Gradient Ascent on Poisoned Data

Maximizes the loss to make the model "forget":

θ = θ + α * ∇L(θ; D_poison)

3. Fisher-Weighted Regularization

Prevents catastrophic forgetting by penalizing large changes to critical weights:

L_total = -L_poison + λ * Σ F_ii * (θ_i - θ_i^original)²

📁 Project Structure

verril-learn/
├── setup.py              # Package configuration
├── requirements.txt      # Dependencies
├── README.md             # This file
└── verril_learn/
    ├── __init__.py       # Public API
    ├── data_loader.py    # MNIST loading + poisoning
    ├── model.py          # CNN architecture
    └── core.py           # Surgical unlearning algorithm

📚 References

📄 License

MIT License - See LICENSE file for details.


Built with ❤️ for the ML Security & Privacy community

Metadata

Release files for verril-learn 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for verril-learn 0.1.0
File Size Uploaded
verril_learn-0.1.0.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for verril-learn 0.1.0
File Interpreter ABI Platform
verril_learn-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / verril_learn-0.1.0.tar.gz

Download URL verril_learn-0.1.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
52369d0e7851925562331be68a9c0e5211563f0632d802051ab70b1dab639cc1
BLAKE2b-256 checksum
How to use checksums
84cafb6f939b7c54fb2dff909ccc759fe4e0e657c2cd7aad4f14bdb3d9ae9a20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release files / verril_learn-0.1.0-py3-none-any.whl

Download URL verril_learn-0.1.0-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c79fc4d67c82ce6d950aefe38e3036d2f19ecb73ddf41bee5d5bd43d37da62d
BLAKE2b-256 checksum
How to use checksums
da1f294594a3cab0afcbeaaedaa3cffc1c8d97890b8ce533fd2b6d72c805c6a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page