Skip to content

Conversation

@gabmun19
Copy link

📋 Summary

This PR integrates the EGSteal explanation-guided surrogate (model extraction) attack into PyGIP’s BaseAttack framework for PyTorch Geometric (PyG) workflows.

In addition, it introduces a lightweight TU graph dataset wrapper for graph classification datasets (e.g., NCI109, AIDS, Mutagenicity) and improves import robustness by making DGL-dependent components optional, enabling PyG-only usage on platforms where DGL is unavailable (e.g., macOS).


What Changed

New Attack: EGStealAttack

  • Implemented under pygip/models/attack/egsteal/
  • Supports explanation-guided extraction using:
    • CAM
    • GradCAM
    • Gradient-based explanations
    • (Optional: GNNExplainer / PGExplainer when enabled)
  • Pipeline:
    • Train target (victim) GNN
    • Query target for predictions and explanations
    • Train surrogate with explanation alignment
  • Reports:
    • Surrogate test accuracy and AUC
    • Target–surrogate fidelity
    • Explanation rank correlation (Kendall τ)

New Dataset Wrapper: TUGraph (PyG-only)

  • Enables TU graph classification datasets via PyG:
    • NCI109
    • AIDS
    • Mutagenicity
  • Designed for api_type="pyg"
  • Cleanly integrates with existing PyGIP dataset abstractions

Import Robustness (DGL Optional)

  • DGL-dependent datasets and attacks are now imported conditionally
  • Allows:
    • Importing pygip.datasets and pygip.models.attack
    • Running PyG-based attacks (including EGSteal)
  • Prevents import-time failures in environments without DGL (e.g., macOS)

🧪 Related Issues


Platform Note (macOS & DGL)

During development, DGL could not be installed on macOS due to missing prebuilt wheels.
To address this without removing DGL support:

  • All DGL-dependent attacks and datasets are conditionally imported
  • PyG-only workflows continue to function normally
  • Clear errors are raised only if api_type="dgl" is explicitly requested

✅ Checklist

  • My code follows the project's coding style
  • I have tested the changes and verified that they work
  • I have added an example script demonstrating usage
  • The PR is made from a feature branch, not main

🧠 Additional Context

Example command to reproduce locally:

python examples/egsteal_attack.py --dataset NCI109 --epochs 5 --mode CAM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant