Adversarial Learning-based Self-improving Content Moderation System
EvoGuard is an MLOps project where attacker and defender models compete to evolve content moderation capabilities. The system automatically improves detection rates through adversarial training.
┌─────────────────────────────────────────────────────────────────────────────┐
│ EvoGuard Architecture │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Attacker │ ──────► │ Battle API │ ◄────── │ Defender │ │
│ │ (Ollama + │ │ (Go) │ │ (BERT + │ │
│ │ Mistral 7B) │ │ │ │ QLoRA) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌──────────────────┐ │ │
│ │ │ Model Monitoring │ │ │
│ │ │ - Drift Detection│ │ │
│ │ │ - Alert System │ │ │
│ │ │ - Auto Retrain │ │ │
│ │ └──────────────────┘ │ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ Feature Store │ │
│ │ Offline (Parquet) │ Online (Redis) │ Registry (PG) │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
| Component | Technology |
|---|---|
| Backend API | Go 1.21+ (Gin) |
| ML Service | Python 3.12 (FastAPI) |
| Attacker LLM | Ollama + Mistral 7B |
| Defender Model | BERT + QLoRA |
| Feature Store | Parquet + Redis + PostgreSQL |
| Experiment Tracking | MLflow |
| Monitoring | Prometheus + Grafana |
| Infrastructure | Docker, Kubernetes |
git clone https://github.com/ressKim-io/EvoGuard.git
cd EvoGuard
make setup
# Start all services (PostgreSQL, Redis, MLflow, Prometheus, Grafana)
make docker-up
# Or start specific services
docker compose -f infra/docker-compose.yml up -d postgres redis
# API Service (Go)
cd api-service
make run
# ML Service (Python)
cd ml-service
make run
| Service | URL |
|---|---|
| API Docs | http://localhost:8080/swagger |
| MLflow | http://localhost:5000 |
| Grafana | http://localhost:3000 |
| Prometheus | http://localhost:9090 |
EvoGuard/
├── api-service/ # Go REST API (Battle management)
│ ├── cmd/ # Application entry points
│ ├── internal/ # Internal packages
│ │ ├── adapter/ # HTTP handlers, repositories
│ │ ├── domain/ # Business entities
│ │ └── usecase/ # Business logic
│ └── pkg/ # Public packages
│
├── ml-service/ # Python ML Service
│ ├── src/ml_service/
│ │ ├── api/ # FastAPI endpoints
│ │ ├── core/ # Config, exceptions, protocols
│ │ ├── feature_store/# Offline, Online, Registry
│ │ ├── models/ # Classifier implementations
│ │ ├── monitoring/ # Drift detection, alerts
│ │ ├── services/ # Inference service
│ │ └── training/ # QLoRA fine-tuning
│ └── tests/
│
├── attacker/ # Adversarial attack generator
│ ├── strategies/ # Attack strategies
│ └── prompts/ # LLM prompts
│
├── infra/ # Infrastructure configs
│ ├── docker-compose.yml
│ ├── grafana/ # Dashboards, alerting
│ └── k8s/ # Kubernetes manifests
│
└── data/ # Data directory (DVC managed)
# All tests
make test
# API Service tests
cd api-service && make test
# ML Service tests
cd ml-service && make test
# Lint all
make lint
# Format code
make fmt
cd ml-service
# Install training dependencies
uv pip install --group training
# Run training
python scripts/train.py --data data/train.csv --epochs 3 --batch-size 4
The ML service includes comprehensive monitoring:
Access at http://localhost:3000 with default credentials (admin/admin).
Panels include:
Environment variables are documented in .env.example:
# Copy and customize
cp .env.example .env
Key configurations:
ML_SERVICE_URL: ML service endpointREDIS_URL: Redis connection stringDATABASE_URL: PostgreSQL connection stringMLFLOW_TRACKING_URI: MLflow server URLFor detailed architecture documentation, see docs/ARCHITECTURE.md.
See CONTRIBUTING.md for development guidelines.
MIT License - see LICENSE for details.
99 commits
Python
92.0%
Go
5.3%
Shell
1.9%
Adversarial Learning-based Self-improving Content Moderation System
EvoGuard is an MLOps project where attacker and defender models compete to evolve content moderation capabilities. The system automatically improves detection rates through adversarial training.
┌─────────────────────────────────────────────────────────────────────────────┐
│ EvoGuard Architecture │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Attacker │ ──────► │ Battle API │ ◄────── │ Defender │ │
│ │ (Ollama + │ │ (Go) │ │ (BERT + │ │
│ │ Mistral 7B) │ │ │ │ QLoRA) │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌──────────────────┐ │ │
│ │ │ Model Monitoring │ │ │
│ │ │ - Drift Detection│ │ │
│ │ │ - Alert System │ │ │
│ │ │ - Auto Retrain │ │ │
│ │ └──────────────────┘ │ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ Feature Store │ │
│ │ Offline (Parquet) │ Online (Redis) │ Registry (PG) │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
| Component | Technology |
|---|---|
| Backend API | Go 1.21+ (Gin) |
| ML Service | Python 3.12 (FastAPI) |
| Attacker LLM | Ollama + Mistral 7B |
| Defender Model | BERT + QLoRA |
| Feature Store | Parquet + Redis + PostgreSQL |
| Experiment Tracking | MLflow |
| Monitoring | Prometheus + Grafana |
| Infrastructure | Docker, Kubernetes |
git clone https://github.com/ressKim-io/EvoGuard.git
cd EvoGuard
make setup
# Start all services (PostgreSQL, Redis, MLflow, Prometheus, Grafana)
make docker-up
# Or start specific services
docker compose -f infra/docker-compose.yml up -d postgres redis
# API Service (Go)
cd api-service
make run
# ML Service (Python)
cd ml-service
make run
| Service | URL |
|---|---|
| API Docs | http://localhost:8080/swagger |
| MLflow | http://localhost:5000 |
| Grafana | http://localhost:3000 |
| Prometheus | http://localhost:9090 |
EvoGuard/
├── api-service/ # Go REST API (Battle management)
│ ├── cmd/ # Application entry points
│ ├── internal/ # Internal packages
│ │ ├── adapter/ # HTTP handlers, repositories
│ │ ├── domain/ # Business entities
│ │ └── usecase/ # Business logic
│ └── pkg/ # Public packages
│
├── ml-service/ # Python ML Service
│ ├── src/ml_service/
│ │ ├── api/ # FastAPI endpoints
│ │ ├── core/ # Config, exceptions, protocols
│ │ ├── feature_store/# Offline, Online, Registry
│ │ ├── models/ # Classifier implementations
│ │ ├── monitoring/ # Drift detection, alerts
│ │ ├── services/ # Inference service
│ │ └── training/ # QLoRA fine-tuning
│ └── tests/
│
├── attacker/ # Adversarial attack generator
│ ├── strategies/ # Attack strategies
│ └── prompts/ # LLM prompts
│
├── infra/ # Infrastructure configs
│ ├── docker-compose.yml
│ ├── grafana/ # Dashboards, alerting
│ └── k8s/ # Kubernetes manifests
│
└── data/ # Data directory (DVC managed)
# All tests
make test
# API Service tests
cd api-service && make test
# ML Service tests
cd ml-service && make test
# Lint all
make lint
# Format code
make fmt
cd ml-service
# Install training dependencies
uv pip install --group training
# Run training
python scripts/train.py --data data/train.csv --epochs 3 --batch-size 4
The ML service includes comprehensive monitoring:
Access at http://localhost:3000 with default credentials (admin/admin).
Panels include:
Environment variables are documented in .env.example:
# Copy and customize
cp .env.example .env
Key configurations:
ML_SERVICE_URL: ML service endpointREDIS_URL: Redis connection stringDATABASE_URL: PostgreSQL connection stringMLFLOW_TRACKING_URI: MLflow server URLFor detailed architecture documentation, see docs/ARCHITECTURE.md.
See CONTRIBUTING.md for development guidelines.
MIT License - see LICENSE for details.
99 commits
Python
92.0%
Go
5.3%
Shell
1.9%