Community-driven AI security audit tool using interpretability techniques
Project description
Community AI Audit is a unified security auditing platform for AI/ML models. It provides vulnerability scanning, red team attack simulations, mechanistic interpretability analysis, alignment auditing, and a unified 7-dimension scoring engine โ all from a single CLI.
๐ What You Can Do
| Use Case | What It Solves |
|---|---|
| ๐ก๏ธ Vulnerability Scanning | Detect adversarial susceptibility, backdoors, prompt injection, data extraction, toxicity, watermark detectability |
| โ๏ธ Red Team Testing | Simulate jailbreak, multi-turn, obfuscation, roleplay, and tool exploitation attacks |
| ๐ง Mechanistic Interpretability | Probe representations, attention patterns, feature attribution, and layer behavior |
| ๐ฏ Alignment Auditing | Measure sycophancy, preference drift, value alignment, and objective robustness |
| ๐ Unified Scoring | Aggregate 7 security dimensions into a single risk score with configurable weights |
| ๐ Trend Tracking | Monitor score evolution across time and detect regressions |
| ๐ก SIEM Integration | Push findings to Splunk, Elastic, Datadog, Sentinel, and 9+ other platforms |
โก Quickstart
pip install community-ai-audit
# Discover available plugins
community-ai-audit discover
# Scan a model
community-ai-audit scan distilgpt2 --provider huggingface --profile quick
# Full audit with SIEM push
community-ai-audit audit meta-llama/Llama-3-8B-Instruct \
--provider huggingface --profile standard \
--connectors splunk elastic
# Red team attack simulation
community-ai-audit redteam gpt-4 --provider openai
# Alignment auditing
community-ai-audit alignment claude-3-opus --provider anthropic
# Compute unified 7-dimension score
community-ai-audit audit-score \
--scan scan_results.json \
--redteam redteam_results.json \
--alignment alignment_results.json
๐งฉ Capabilities
Model Support โ 9 Adapters
| Provider | Adapter | Auto-Detect |
|---|---|---|
| HuggingFace | huggingface |
*/* or llama* |
| OpenAI | openai |
gpt-*, o1*, o3* |
| Anthropic | anthropic |
claude-* |
| AWS Bedrock | aws_bedrock |
โ |
| Local (PyTorch/TF/ONNX) | local |
Path/URI/*.pt/*.onnx |
| Ollama | ollama |
name:tag (no /) |
| Replicate | replicate |
โ |
| VertexAI | vertexai |
โ |
| Groq | groq |
โ |
Security Scanning โ 7 Scanners
| Scanner | What It Detects | Technique |
|---|---|---|
adversarial |
FGSM/PGD perturbation susceptibility | Gradient-based attacks |
backdoor |
Triggered malicious behavior | Activation clustering |
prompt_injection |
Injection vulnerabilities | Heuristic pattern matching |
data_extraction |
Training data / secret extraction | Response entropy analysis |
toxicity |
Toxic / biased outputs | Keyword + classifier scoring |
watermark |
Watermark detectability | Statistical pattern analysis |
dsl |
User-defined rules | YAML rule engine |
Red Team โ 5 Attack Scanners
| Scanner | Attack Surface | Evaluation |
|---|---|---|
jailbreak |
20 known jailbreak prompts | Refusal vs success pattern matching |
multi_turn_attack |
10 two-turn conversation attacks | Suspicious-keyword breach detection |
prompt_obfuscation |
10 obfuscated variants (base64, leetspeak) | Harmful-keyword matching |
roleplay_attack |
15 roleplay scenarios (DAN, character shells) | Refusal vs engagement patterns |
tool_exploitation |
10 tool-misuse prompts | Exploit-keyword detection |
Mechanistic Interpretability โ 5 Analyzers
| Analyzer | Probes | What It Measures |
|---|---|---|
activation_probes |
5 probe inputs | Response quality, SNR estimate |
representation_analysis |
8 probes, 4 pairs | Jaccard differentiation, vocabulary size |
attention_head_analysis |
5 syntactic probes | Attention complexity estimate |
feature_attribution |
5 sentiment inputs | Word-level importance, sentiment match |
layer_analysis |
3 open-ended probes | Depth estimation, complexity distribution |
Alignment Auditing โ 4 Scanners
| Scanner | Prompts | What It Detects |
|---|---|---|
sycophancy |
5 agree + 5 disagree | Stance-sycophancy (rubber-stamping) |
preference_drift |
5 cores ร 3 variants | Sentiment inconsistency across paraphrases |
value_alignment |
8 probes across 6 values | Refusal of harmful, encouragement of prosocial |
objective_robustness |
3 objectives ร 4 prompts | Refusal-pattern violations per objective |
Scoring โ 7 Dimensions
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Unified Audit Score โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Security โ โโโโโโโโโโโโโโโโโโ 82.0 โ
โ Reliability โ โโโโโโโโโโโโโโโโโโ 72.0 โ
โ Compliance โ โโโโโโโโโโโโโโโโโโ 90.0 โ
โ Agent Risk โ โโโโโโโโโโโโโโโโโโ 80.0 โ
โ Alignment โ โโโโโโโโโโโโโโโโโโ 85.0 โ
โ Red Team โ โโโโโโโโโโโโโโโโโโ 60.0 โ
โ Interpretability โ โโโโโโโโโโโโโโโโโโ 65.0 โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Overall: 77.6 (Good) โ
โ Weights: security=0.2, reliability=0.1, ... โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Executive Dashboard
Real-time HTML dashboard served via dashboard_v2/server.py:
- 7 color-coded score cards (critical โ excellent)
- JSON overlay endpoint for programmatic updates
- Configurable refresh interval
- Responsive CSS grid layout
๐ง Installation
# Core (numpy, pyyaml, scikit-learn)
pip install community-ai-audit
# Optional extras
pip install community-ai-audit[torch] # Torch-based scanners
pip install community-ai-audit[scheduler] # Cron scheduling
pip install community-ai-audit[hf] # HuggingFace transformers
pip install community-ai-audit[tf] # TensorFlow
# Development
git clone https://github.com/anomalyco/community-ai-audit
cd community-ai-audit
pip install -e .[dev]
๐ป CLI Reference
| Command | Description |
|---|---|
scan <model> -p <provider> |
Run vulnerability scanners |
interpret <model> -p <provider> |
Run interpretability methods |
audit <model> -p <provider> |
Full pipeline: scan + interpret + report + push |
redteam <model> -p <provider> |
Red team attack simulations |
mechinterp <model> -p <provider> |
Mechanistic interpretability analysis |
alignment <model> -p <provider> |
Alignment auditing |
audit-score |
Compute unified 7-dimension score |
discover |
List all discovered plugins |
schedule add/list/remove/run |
Manage recurring audits |
Exit codes: 0 = ok, 1 = HIGH/MEDIUM findings, 2 = CRITICAL findings.
๐ Documentation
| Resource | Description |
|---|---|
| Architecture & Reference | Full component docs, API, CLI, config, deployment |
| Plugin Guide | Writing custom adapters, scanners, interpreters |
| Scanner Guide | Details on each vulnerability scanner |
| Adapter Guide | Details on each model adapter |
| Connector Guide | SIEM and storage connector details |
| Red Team | Attack framework and scanner reference |
| Mech Interp | Analyzer reference and methodology |
| Alignment | Alignment scanner reference |
| Scoring Engine | 7-dimension scoring details |
| Dashboard | Executive dashboard server |
๐ Configuration
cache:
enabled: true
max_size: 1000
ttl_seconds: 3600
scanners:
adversarial:
num_samples: 32
pgd_steps: 10
backdoor:
sample_size: 128
connectors:
splunk:
url: "${SPLUNK_URL}"
token: "${SPLUNK_TOKEN}"
elastic:
url: "${ELASTIC_URL}"
api_key: "${ELASTIC_API_KEY}"
Config values can also be set via environment variables: COMMUNITY_AI_AUDIT_CONNECTORS_SPLUNK_URL.
Precedence (lowest โ highest): default.yaml โ --config PATH โ env vars โ CLI args.
API Key Safety
COMMUNITY_AI_AUDIT_API_KEYenv var (recommended)--api-key-file PATH(reads from file, not visible in ps)--api-key VALUE(โ ๏ธ visible in process list)
๐ Deployment
# Docker
docker build -t community-ai-audit .
docker run -v $(pwd)/config:/app/config community-ai-audit scan model.pt -p local
# Docker Compose
docker-compose up -d
# Helm (Kubernetes)
helm install community-ai-audit ./charts/community-ai-audit
# Air-Gapped
./scripts/airgap-bundle.sh # On connected machine
./scripts/offline-install.sh # On air-gapped machine
๐งช Testing
# All tests (no torch/croniter needed)
pytest tests/
# With coverage
pytest --cov=community_ai_audit tests/
508+ tests covering unit, integration, CLI, connectors, red team, mechanistic interpretability, alignment, trend tracking, and drift analysis.
๐ค Contributing
We welcome contributions! See our Plugin Guide to get started writing custom scanners, adapters, or connectors.
๐ License
MIT ยฉ Anomaly Co.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file community_ai_audit-0.5.1.tar.gz.
File metadata
- Download URL: community_ai_audit-0.5.1.tar.gz
- Upload date:
- Size: 187.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0b24dc4a489278c33fffaef5bd0d16e3ff0bb8fa0391d91a07a3c7a3ee94355
|
|
| MD5 |
f4b744bcf6b135c8acae9b498073545d
|
|
| BLAKE2b-256 |
76e299d1f27cc5d491589d84304ee60769a36b503372a93b765988e72ada2cb1
|
File details
Details for the file community_ai_audit-0.5.1-py3-none-any.whl.
File metadata
- Download URL: community_ai_audit-0.5.1-py3-none-any.whl
- Upload date:
- Size: 247.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a26653dfd8802f7899197bb375e524720e3f1edbe33aabcd24ec8c1af1d9f87b
|
|
| MD5 |
5b2566faa25ee024e771a94a6acc2c68
|
|
| BLAKE2b-256 |
985bbd6a37bbd58f6c5b015d83674ef738b0042755e036f52de0d07f5e2baf4a
|