How sania-2520/veriunlearn works
Purpose and topology
VeriUnlearn is a privacy-focused conversational-AI platform that trains and serves LoRA-adapted models, processes deletion/unlearning requests, and issues cryptographic evidence that removed data no longer affects a model. The canonical product layout is the packages/ monorepo: frontend → Nginx → FastAPI backend → ML engine, with asynchronous work handled by Celery.
Entry points and user surface
The Next.js dashboard provides authentication, administration, model/training, RAG, audit, monitoring, and unlearning workflows. Its API client boundary is separate from page components.
• packages/frontend/src/app/page.tsx
• packages/frontend/src/app/dashboard/unlearning/page.tsx
• packages/frontend/src/lib/api/client.ts
The FastAPI application is the primary server entry point; versioned handlers expose auth, datasets, training, unlearning, verification, compliance, and related enterprise APIs.
• packages/backend/app/main.py
• packages/backend/app/api/v1/unlearning.py
• packages/backend/app/api/v1/verification.py
Backend domain and persistence boundary
The backend follows a domain/infrastructure split: API handlers and dependencies invoke domain services through interfaces, while repositories persist infrastructure models. Core middleware, RBAC, rate limiting, configuration, and secrets management govern request entry.
• packages/backend/app/domain/unlearning/services.py
• packages/backend/app/infrastructure/database/repositories/unlearning.py
• packages/backend/app/core/security.py
PostgreSQL is the system-of-record database, with Alembic migrations in packages/backend/alembic/. Redis provides caching and Celery coordination.
Training and model lifecycle
The ML engine owns PyTorch model execution and lifecycle: data preparation, LoRA training, continual-learning mechanisms, experiment/MLflow tracking, model registration, inference, and benchmark execution. The backend reaches it through an explicit external ML-engine adapter rather than embedding all model logic in route handlers.
• packages/ml-engine/training/lora_trainer.py
• packages/ml-engine/training/model_registry.py
• packages/backend/app/infrastructure/external/ml_engine.py
Model artifacts are intended for MinIO; MLflow tracks training experiments. Qdrant supports vector/RAG storage.
Unlearning pipeline
A deletion request enters the backend domain, is scheduled as a Celery task, then the ML engine selects or executes SISA, influence-function, or certified-removal algorithms. The hybrid controller provides adaptive algorithm selection. Result status and artifacts return through backend APIs and persistence.
• packages/backend/app/workers/unlearning_tasks.py
• packages/ml-engine/unlearning/e2e_pipeline.py
• packages/ml-engine/unlearning/hybrid_controller.py
This asynchronous boundary isolates potentially long-running GPU/CPU model operations from HTTP request handling. Kubernetes deploys the backend, Celery worker, and ML engine separately.
Verification, audit, and compliance
After unlearning, verification evaluates privacy/quality, builds Merkle evidence, signs certificates, and supports zk-SNARK proof generation. Audit and compliance domains preserve traceability; blockchain anchoring is exposed as an external integration.
• packages/ml-engine/verification/merkle_tree.py
• packages/ml-engine/verification/signatures.py
• packages/ml-engine/verification/zksnark_service.py
• packages/backend/app/infrastructure/external/blockchain.py
Relevant API/domain boundaries include audit, compliance, and verification rather than the model algorithms themselves.
Deployment and operations
Docker supports local composition; Nginx is the edge reverse proxy. Production infrastructure targets Kubernetes through raw manifests, Kustomize overlays, and a Helm chart; Terraform provisions AWS EKS. Prometheus, Grafana, Loki, and Alertmanager provide metrics, dashboards, logs, and alerting.
• docker-compose.yml
• nginx/default.conf
• infra/kubernetes/base/kustomization.yaml
• infra/kubernetes/helm/veriunlearn/Chart.yaml
• infra/terraform/modules/eks/main.tf
Main entry points: lora_trainer.py ML engine · unlearning_tasks.py Celery unlearning worker · main.py FastAPI application · kustomization.yaml Kubernetes deployment
Components 22
Product surface
- Next.js dashboard · User workflows for models, RAG, audit, and unlearning.
packages/frontend/src/app/dashboard/unlearning/page.tsx - API client
packages/frontend/src/lib/api/client.ts - Nginx edge
nginx/default.conf
Backend & async
- FastAPI application · Versioned enterprise API entry point.
packages/backend/app/main.py - Unlearning & verification APIs
packages/backend/app/api/v1/unlearning.py - Unlearning domain service · Coordinates deletion lifecycle through interfaces.
packages/backend/app/domain/unlearning/services.py - Unlearning repository
packages/backend/app/infrastructure/database/repositories/unlearning.py - Celery unlearning worker · Runs long-lived deletion jobs outside HTTP requests.
packages/backend/app/workers/unlearning_tasks.py - ML-engine adapter
packages/backend/app/infrastructure/external/ml_engine.py
ML lifecycle
- ML engine · Executes training, inference, unlearning, and benchmarks.
packages/ml-engine/training/lora_trainer.py - Model registry · Registers trained model versions.
packages/ml-engine/training/model_registry.py - Unlearning pipeline · Executes SISA, influence, or certified removal.
packages/ml-engine/unlearning/e2e_pipeline.py - Hybrid controller · Adaptively selects the unlearning strategy.
packages/ml-engine/unlearning/hybrid_controller.py
Verification
- Evidence & proof service · Builds Merkle evidence, signatures, and zk proofs.
packages/ml-engine/verification/merkle_tree.py - Blockchain anchoring
packages/backend/app/infrastructure/external/blockchain.py
Data & platform
- PostgreSQL · Schema evolution is managed by Alembic.
packages/backend/alembic/env.py - Redis · Provides caching and Celery coordination.
- MinIO model artifacts
- MLflow
- Qdrant · Stores vectors for RAG.
- Kubernetes deployment · Deploys backend, workers, and ML engine independently.
infra/kubernetes/base/kustomization.yaml - Monitoring stack · Prometheus, Grafana, Loki, and Alertmanager.
Connections 26
- Next.js dashboard → API client: uses
- API client → Nginx edge: HTTPS API calls
- Nginx edge → FastAPI application: proxies
- FastAPI application → Unlearning & verification APIs: routes requests
- Unlearning & verification APIs → Unlearning domain service: invokes
- Unlearning domain service → Unlearning repository: persists status
- Unlearning repository → PostgreSQL: stores records
- Unlearning domain service → Celery unlearning worker: schedules deletion
- Celery unlearning worker → Redis: broker coordination
- Celery unlearning worker → ML-engine adapter: dispatches job
- ML-engine adapter → ML engine: calls
- ML engine → Model registry: registers versions
- ML engine → MinIO model artifacts: reads and writes artifacts
- ML engine → MLflow: tracks experiments
- ML engine → Qdrant: serves RAG vectors
- ML engine → Unlearning pipeline: runs deletion
- Unlearning pipeline → Hybrid controller: selects algorithm
- Unlearning pipeline → Evidence & proof service: submits result
- Evidence & proof service → Blockchain anchoring: anchors evidence
- Evidence & proof service → Unlearning repository: records certificate status
- Kubernetes deployment → FastAPI application: deploys
- Kubernetes deployment → Celery unlearning worker: deploys
- Kubernetes deployment → ML engine: deploys
- FastAPI application → Monitoring stack: emits telemetry
- Celery unlearning worker → Monitoring stack: emits telemetry
- ML engine → Monitoring stack: emits telemetry