Catalog PyPI
Back to packageRELEASE DETAILS

1.0.0

PyPI

aibt-fl

AIBT: Adversarial Information Bottleneck Training for Privacy-Preserving Federated Learning

adversarial-trainingdeep-learningdifferential-privacyfederated-learninginformation-bottleneckmachine-learningneural-networksprivacy-preservingpytorchsecure-aggregation
Published2 Feb 2026
Direct dependencies10
Transitive dependenciesNot calculated

README

Version 1.0.0 documentation

AIBT: Adversarial Information Bottleneck Training

PyPI version Python 3.8+ PyTorch License: MIT

Privacy-preserving federated learning with information-theoretic privacy guarantees

Overview

AIBT (Adversarial Information Bottleneck Training) is a privacy-preserving federated learning framework that combines information bottleneck theory with adversarial training to achieve strong privacy guarantees while maintaining high model utility.

Key Features

  • 🔒 Privacy-Preserving: Combines Information Bottleneck (IB) with adversarial training
  • 🌐 Federated Learning: Distributed training with FedAvg aggregation
  • 🛡️ Attack Resistant: Defends against Membership and Attribute Inference attacks
  • 🚀 Easy to Use: Simple API for training and evaluation
  • 📊 Built-in Metrics: Privacy attack evaluation included

Installation

pip install aibt-fl

From Source

git clone https://github.com/aibt/aibt.git
cd aibt/aibt_package
pip install -e .

Quick Start

import torch
from aibt import AIBTFL, AIBTModel, create_aibt_model, evaluate_privacy

# Create an AIBT model for your data
model = create_aibt_model(
    input_dim=13,           # Number of input features
    num_classes=2,          # Number of output classes
    latent_dim=64,          # Latent space dimension
    num_sensitive_classes=2 # Number of sensitive attribute classes
)

# Initialize AIBT Federated Learning
aibt = AIBTFL(
    model=model,
    num_clients=10,
    device="cpu",
    learning_rate=0.001,
    lambda_kl=0.01,     # KL divergence weight (Information Bottleneck)
    lambda_adv=1.0,     # Adversarial loss weight
)

# Setup clients with their data
aibt.setup_clients(
    client_datasets=client_data,        # List of (X, y) tuples per client
    sensitive_data=client_sensitive     # Optional: sensitive attributes
)

# Train with federated learning
history = aibt.train(
    num_rounds=100,
    local_epochs=5,
    test_data=(X_test, y_test),
    verbose=True
)

# Evaluate privacy
privacy_metrics = evaluate_privacy(
    model=model,
    train_data=(X_train, y_train),
    test_data=(X_test, y_test),
    device="cpu"
)

print(f"Membership Inference AUC: {privacy_metrics['membership_auc']:.4f}")
print(f"Privacy preserved: {privacy_metrics['membership_auc'] < 0.55}")

Architecture

AIBT combines three key components:

Input → Encoder → Compressed Representation → Predictor → Output
                         ↓
                    Adversary (tries to infer sensitive info)
                         ↓
                  Gradient Reversal Layer

Loss Function:

L = L_task + λ₁ L_KL - λ₂ L_adv
  • L_task: Task-specific loss (e.g., cross-entropy)
  • L_KL: KL divergence for information bottleneck compression
  • L_adv: Adversarial loss for privacy (with gradient reversal)

API Reference

Core Classes

AIBTFL

Main federated learning class with AIBT training.

AIBTFL(
    model,                      # AIBTModel instance
    num_clients=10,             # Number of federated clients
    device="cpu",               # Device (cpu/cuda)
    learning_rate=0.001,        # Learning rate
    batch_size=32,              # Batch size
    lambda_kl=0.01,             # KL divergence weight
    lambda_adv=1.0,             # Adversarial loss weight
    lambda_grl=1.0,             # Gradient reversal strength
)

AIBTModel

Complete AIBT model with encoder, predictor, and adversary.

AIBTModel(
    encoder,            # Encoder network
    predictor,          # Task predictor
    adversary,          # Adversary network
    lambda_kl=0.01,     # KL weight
    lambda_adv=1.0,     # Adversarial weight
    lambda_grl=1.0,     # GRL strength
)

Model Components

  • GradientReversalLayer: Reverses gradients during backprop for adversarial training
  • VariationalEncoder: Information bottleneck encoder with reparameterization
  • MLPEncoder: MLP encoder for tabular data
  • Predictor: Task prediction head
  • Adversary: Sensitive attribute classifier

Privacy Metrics

from aibt import evaluate_privacy, evaluate_membership_inference, evaluate_attribute_inference

# Complete privacy evaluation
metrics = evaluate_privacy(model, train_data, test_data, sensitive_train, sensitive_test)

# Individual attacks
mia_metrics = evaluate_membership_inference(model, train_data, test_data)
aia_metrics = evaluate_attribute_inference(model, X, sensitive_attrs)

Hyperparameters

ParameterDefaultDescription
lambda_kl0.01KL divergence weight (compression)
lambda_adv1.0Adversarial loss weight (privacy)
lambda_grl1.0Gradient reversal strength
latent_dim128Latent space dimension
learning_rate0.001Optimizer learning rate
batch_size32Training batch size

Hyperparameter Tuning

  • Higher lambda_kl: More compression, potentially lower accuracy
  • Higher lambda_adv: Stronger privacy, may affect utility
  • Recommended range: lambda_kl ∈ [0.005, 0.02], lambda_adv ∈ [0.5, 2.0]

Citation

If you use AIBT in your research, please cite:

@article{aibt2025,
  title={Adversarial Information Bottleneck Training for Privacy-Preserving Federated Learning},
  journal={IEEE Transactions on Neural Networks and Learning Systems},
  year={2025}
}

References

  • Tishby et al., "The Information Bottleneck Method", Allerton 1999
  • Ganin & Lempitsky, "Domain-Adversarial Training of Neural Networks", JMLR 2016
  • McMahan et al., "Communication-Efficient Learning of Deep Networks from Decentralized Data", AISTATS 2017

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 10

Native requirements
10 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
torch
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
torch>=1.9.0runtime
numpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
numpy>=1.19.0runtime
scikit-learn
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
scikit-learn>=0.24.0runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest>=6.0; extra == "dev"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov>=2.0; extra == "dev"runtime
black
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
black>=22.0; extra == "dev"runtime
isort
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
isort>=5.0; extra == "dev"runtime
flake8
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
flake8>=4.0; extra == "dev"runtime
sphinx
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
sphinx>=4.0; extra == "docs"runtime
sphinx-rtd-theme
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
sphinx-rtd-theme>=1.0; extra == "docs"runtime

Distribution files

2 collected
aibt_fl-1.0.0-py3-none-any.whl

bdist_wheel · 19.41 KB · Python py3

Source file
aibt_fl-1.0.0.tar.gz

sdist · 20.89 KB · Python source

Source file

Repository

PENDING
aibt/aibt

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:04 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:6c21d069f8828be196cf52eae57a01c61d1b59bfdf7a32e3b2f0fcc7da9ca469

Other collected versions

View all collected versions →