Skip to main content

Community-driven AI security audit tool using interpretability techniques

Project description

Community AI Security Audit Tool

PyPI version Python versions License

A plug-and-play, community-driven AI security audit framework. Scan any model (local, HF Hub, OpenAI, Anthropic, AWS Bedrock, Ollama) for vulnerabilities, interpret decisions, and push findings to your SIEM (Splunk, Elastic, Datadog, Sentinel).

Features

  • Model Adapters: HuggingFace, OpenAI, Anthropic, AWS Bedrock, Local (PyTorch/ONNX/SafeTensors), Ollama
  • Vulnerability Scanners: Backdoor/Trojan detection (activation clustering), Adversarial robustness (FGSM/PGD)
  • Interpretability: Integrated Gradients, LIME
  • SIEM Connectors: Splunk HEC, Elastic/Elasticsearch, Datadog Logs, Microsoft Sentinel
  • Reporting: Markdown, JSON, HTML
  • CLI: discover, scan, interpret, audit commands
  • Extensible: Plugin system for custom adapters, scanners, interpreters, connectors

Quickstart

# Install
pip install community-ai-audit[hf]  # with HuggingFace support

# Discover available plugins
community-ai-audit discover

# Scan a HuggingFace model
community-ai-audit scan distilgpt2 --provider huggingface --profile quick

# Full audit (scan + interpret) with SIEM push
community-ai-audit audit meta-llama/Llama-3-8B-Instruct \
  --provider huggingface \
  --profile standard \
  --scanners backdoor adversarial \
  --interpreters integrated-gradients lime \
  --connectors splunk elastic \
  --config config/my_connectors.yaml

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                      AuditEngine                                │
│  (orchestrates: load → scan → interpret → report → push)       │
└─────────────────────────────────────────────────────────────────┘
         │                    │                    │
         ▼                    ▼                    ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│   Adapters      │ │   Scanners      │ │  Interpreters   │
│  (load_model)   │ │  (scan model)   │ │ (explain model) │
├─────────────────┤ ├─────────────────┤ ├─────────────────┤
│ • HuggingFace   │ │ • Backdoor      │ │ • Integrated    │
│ • OpenAI        │ │ • Adversarial   │ │   Gradients     │
│ • Anthropic     │ │ • (custom)      │ │ • LIME          │
│ • AWS Bedrock   │ │                 │ │ • (custom)      │
│ • Local         │ │                 │ │                 │
│ • Ollama        │ │                 │ │                 │
└─────────────────┘ └─────────────────┘ └─────────────────┘
         │                    │                    │
         └────────────────────┼────────────────────┘
                              ▼
                   ┌─────────────────────┐
                   │   Reporters         │
                   │ (markdown, json,    │
                   │  html)              │
                   └─────────────────────┘
                              │
                              ▼
                   ┌─────────────────────┐
                   │  SIEM Connectors    │
                   │ (push findings)     │
                   ├─────────────────────┤
                   │ • Splunk HEC        │
                   │ • Elastic           │
                   │ • Datadog           │
                   │ • Sentinel          │
                   │ • (custom)          │
                   └─────────────────────┘

Provider Matrix

Provider Text Image Multimodal Embedding Auth
HuggingFace HF_TOKEN
OpenAI OPENAI_API_KEY
Anthropic ANTHROPIC_API_KEY
AWS Bedrock AWS creds
Local (PyTorch) None
Ollama Local server

Installation

# Core only
pip install community-ai-audit

# With HuggingFace transformers
pip install community-ai-audit[hf]

# With TensorFlow support
pip install community-ai-audit[tf]

# All optional dependencies
pip install community-ai-audit[all]

# Development install
git clone https://github.com/anomalyco/community-ai-audit
cd community-ai-audit
pip install -e .[dev]

Configuration

Create config/my_config.yaml:

model:
  device: auto
  dtype: auto

scanners:
  backdoor:
    enabled: true
    num_clusters: 5
    activation_threshold: 0.85
  adversarial:
    enabled: true
    epsilon: 0.1
    pgd_steps: 10

connectors:
  splunk:
    hec_url: https://splunk.example.com:8088
    hec_token: ${SPLUNK_HEC_TOKEN}
    index: security
  elastic:
    url: https://es.example.com:9243
    api_key: ${ELASTICSEARCH_API_KEY}

Use with --config config/my_config.yaml.

CLI Commands

Discover

community-ai-audit discover
community-ai-audit discover --format json

Scan

# Quick scan with defaults
community-ai-audit scan distilgpt2 --provider huggingface

# Custom profile and scanners
community-ai-audit scan model.pt --provider local \
  --profile deep \
  --scanners backdoor adversarial \
  --input-shape '[32, 768]' \
  --output markdown --save report.md

Interpret

community-ai-audit interpret distilgpt2 --provider huggingface \
  --interpreters integrated-gradients lime \
  --input "The model should classify this as positive."

Audit (Full Pipeline)

community-ai-audit audit meta-llama/Llama-3-8B-Instruct \
  --provider huggingface \
  --profile standard \
  --scanners backdoor adversarial \
  --interpreters integrated-gradients \
  --connectors splunk elastic \
  --config config/my_connectors.yaml

Extending

See Plugin Guide for:

Known Limitations

  • Scanners require white-box access (gradients/activations) — work best with provider=local or HuggingFace local models
  • Text model adversarial attacks need embedding-space perturbations (token IDs are discrete)
  • Integrated Gradients on text requires access to embedding layer
  • Large model audits can be slow — batch mode coming in v0.2.0
  • TensorFlow support planned

Contributing

See CONTRIBUTING.md and Plugin Guide.

License

MIT License — see LICENSE.

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

community_ai_audit-0.2.0.tar.gz (107.7 kB view details)

Uploaded Source

Built Distribution

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

community_ai_audit-0.2.0-py3-none-any.whl (137.4 kB view details)

Uploaded Python 3

File details

Details for the file community_ai_audit-0.2.0.tar.gz.

File metadata

  • Download URL: community_ai_audit-0.2.0.tar.gz
  • Upload date:
  • Size: 107.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for community_ai_audit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7d05a4580dd3d1b58ac4e245744c39cfe3b6ae62d1caef386989f7916325c746
MD5 75aa911b2a7c2afc50c5f821c6e01d6b
BLAKE2b-256 f0331bdc9850fa892b69268368d3f35c9bf18f22f9b6487bb51ec4f0bf87549a

See more details on using hashes here.

File details

Details for the file community_ai_audit-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for community_ai_audit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3e97ded565076ed9ae819692e7425f2cd637ff923974c4734cba1e37bd33435
MD5 c7bad79606050e205c8eb6d79b5c9e86
BLAKE2b-256 ec00eaa25396206e80507a7fa97bc25c3697e913ccbd22b9f3837f40e553c28e

See more details on using hashes here.

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