Human-in-the-loop ML audit system before model training
A deterministic-first ML engineering project that audits tabular datasets before model development, surfaces data risks, pauses risky workflows for human review, benchmarks baseline models, tracks experiments, explains results, and generates grounded audit reports.
Most ML projects start by training models too early.
In real projects, poor data quality, possible target leakage, class imbalance, and unsuitable metrics can make a model look stronger than it really is.
Agentic ML Audit Copilot solves this by auditing a dataset before model training. It behaves like a junior ML reviewer: it profiles the data, detects common ML risks, routes risky cases through a human review gate, and only then continues to baseline modeling, tracking, explainability, and report generation.
This is not an AutoML tool. The goal is not to train the best possible model. The goal is to decide whether the dataset is ready for responsible baseline experimentation.
https://shivamrajput-ds-agentic-ml-audit-copilo-appstreamlit-app-joxap5.streamlit.app/
https://youtu.be/kFzNam74QBc
https://hub.docker.com/r/shivamrajput130/agentic-ml-audit-copilot
Recommended Docker image:
shivamrajput130/agentic-ml-audit-copilot:v1.1.0
| Area | What the system does |
|---|---|
| Dataset Profiling | Rows, columns, data types, memory usage, missing values, duplicate rows, and target summary |
| Problem Detection | Detects classification or regression setup |
| Data Quality | Finds missing values, duplicates, constant columns, near-constant columns, ID-like columns, high-cardinality columns, infinite values, and outliers |
| Leakage Risk | Flags target-like columns, suspicious names, proxy features, and suspicious correlations |
| Class Imbalance | Measures class distribution, minority class, imbalance ratio, and severity |
| Risk Aggregation | Combines deterministic risk signals into review items |
| Decision Routing | Decides whether the workflow can continue or needs human review |
| Human Review | Allows reviewer decisions before modeling continues |
| Metric Recommendation | Suggests suitable metrics for the detected problem type |
| Preprocessing | Builds scikit-learn preprocessing pipelines |
| Baseline Models | Trains baseline models for comparison |
| MLflow Tracking | Logs baseline experiment metadata and metrics |
| Explainability | Generates built-in feature importance and SHAP-based summaries when available |
| Reports | Exports Markdown and JSON audit reports |
| API | Provides FastAPI endpoints for programmatic audit access |
| UI | Provides a Streamlit dashboard for interactive review |
- Deterministic-first: Python performs ML computation, data checks, and risk detection.
- Human-in-the-loop: Risky datasets can be paused before modeling.
- LLM is not the judge: The LLM is used only for explanations, Q&A, and report writing.
- Baseline-first: The system trains simple baselines instead of pretending to be AutoML.
- Transparent workflow: Every major decision is visible in the dashboard and API response.
- Audit before training: The project focuses on responsible pre-training review.
The architecture separates the Streamlit UI, FastAPI backend, LangGraph workflow, audit modules, risk routing, human review, modeling, tracking, explainability, and reporting layers.
The workflow can pause at the Human Review Gate when important risks are detected.
Reviewer decisions include:
- Accept risk and continue
- Accept flag and fix later
- Mark false positive
- Needs data fix
- Reject modeling
If the final human decision approves modeling, the workflow continues to metric recommendation, preprocessing, baseline models, MLflow, explainability, and final report generation.
If the final human decision rejects modeling, the workflow stops so the dataset can be fixed first.
The API supports both direct audit runs and a human-review-first workflow.
User
|
v
Streamlit UI / FastAPI API
|
v
CSV Upload + Target Selection
|
v
LangGraph Audit Workflow
|
v
Dataset Profiler
|
v
Problem Type Detector
|
v
Parallel Audit Layer
|-- Data Quality Audit
|-- Leakage Detection
|-- Class Imbalance Detection
|
v
Risk Aggregator
|
v
Decision Router
|
v
Human Review Gate
|-- Stop / Fix Dataset
|-- Human Approved
|
v
Metric Recommender
|
v
Preprocessing Pipeline
|
v
Baseline Models
|
v
MLflow Tracking
|
v
Explainability / SHAP
|
v
LLM Audit Report
|
v
Audit Q&A
|
v
Final Dashboard + JSON Report
| Layer | Tools |
|---|---|
| Language | Python |
| Data Processing | Pandas, NumPy |
| Machine Learning | scikit-learn |
| Workflow Orchestration | LangGraph |
| API | FastAPI |
| Dashboard | Streamlit |
| Experiment Tracking | MLflow |
| Explainability | SHAP |
| LLM Provider | Groq |
| Visualization | Plotly |
| Testing | pytest |
| Linting and Formatting | Ruff |
| Packaging | uv |
| Deployment | Docker, Streamlit Community Cloud |
git clone https://github.com/shivamrajput-ds/Agentic-ML-Audit-Copilot.git
cd Agentic-ML-Audit-Copilotuv venv --python 3.12Windows PowerShell:
.venv\Scripts\Activate.ps1Windows Git Bash:
source .venv/Scripts/activateLinux/macOS:
source .venv/bin/activateuv pip install -r requirements.txt
uv pip install -e .Create a .env file locally:
GROQ_API_KEY=your_groq_api_key
Do not commit .env.
For deterministic audit-only usage, LLM features can be disabled if supported by the configuration:
export LLM_ENABLED=falseWindows PowerShell:
$env:LLM_ENABLED="false"uv run streamlit run app/streamlit_app.py --server.port 8501Open:
http://localhost:8501
Use a second terminal:
uv run uvicorn app.api:app --reload --host 127.0.0.1 --port 8000Open:
http://127.0.0.1:8000/docs
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
API information |
| GET | /health |
Health check |
| GET | /metadata |
Project and runtime metadata |
| GET | /workflow-guide |
Human review workflow guide |
| Method | Endpoint | Description |
|---|---|---|
| POST | /audit |
Run audit workflow |
| POST | /audit/summary |
Run audit and return lightweight summary |
| GET | /audit/modes |
Show available audit modes |
| Method | Endpoint | Description |
|---|---|---|
| POST | /audit/review-gate |
Run audit until human review gate |
| GET | /human-review/decision-template |
Return reviewer decision JSON template |
| POST | /audit/after-human-approval |
Continue workflow after reviewer approval |
1. POST /audit/review-gate
2. Review human_review.review_items
3. GET /human-review/decision-template
4. Fill reviewer decision JSON
5. POST /audit/after-human-approval
6. Continue to metrics, baselines, MLflow, SHAP, and final report
The project logs baseline experiment information with MLflow.
Tracked information may include:
- Problem type
- Baseline model names
- Evaluation metrics
- Best baseline model
- Parameters
- Runtime metadata
Run MLflow UI locally:
uv run mlflow ui --backend-store-uri mlruns --host 127.0.0.1 --port 5000Open:
http://127.0.0.1:5000
Note: the Docker container runs FastAPI and Streamlit. MLflow tracking data is generated by the workflow, but the MLflow UI is usually inspected separately in local development.
Run the full test suite:
uv run pytest -qRun a specific test file:
uv run pytest tests/test_data_quality.py -qRun Ruff checks:
uv run ruff check . --fix --unsafe-fixesFormat the project:
uv run ruff format .The Docker image runs both services:
- Streamlit on port
8501 - FastAPI on port
8000
Pull the stable release:
docker pull shivamrajput130/agentic-ml-audit-copilot:v1.1.0Run the stable release:
docker run --rm \
--name agentic-audit-copilot \
-p 8501:8501 \
-p 8000:8000 \
-e GROQ_API_KEY="your_groq_api_key" \
shivamrajput130/agentic-ml-audit-copilot:v1.1.0One-line Git Bash command:
docker run --rm --name agentic-audit-copilot -p 8501:8501 -p 8000:8000 -e GROQ_API_KEY="your_groq_api_key" shivamrajput130/agentic-ml-audit-copilot:v1.1.0Open:
Streamlit Dashboard: http://localhost:8501
FastAPI Docs: http://localhost:8000/docs
Health Check: http://localhost:8000/health
Build locally:
docker build -t agentic-ml-audit-copilot .Run local image:
docker run --rm \
--name agentic-audit-test \
-p 8501:8501 \
-p 8000:8000 \
-e GROQ_API_KEY="your_groq_api_key" \
agentic-ml-audit-copilot:latestTag and push:
docker tag agentic-ml-audit-copilot:latest shivamrajput130/agentic-ml-audit-copilot:latest
docker tag agentic-ml-audit-copilot:latest shivamrajput130/agentic-ml-audit-copilot:v1.1.0
docker push shivamrajput130/agentic-ml-audit-copilot:latest
docker push shivamrajput130/agentic-ml-audit-copilot:v1.1.0More details:
DOCKER.md
Streamlit Community Cloud deploys from GitHub, not Docker Hub.
For Streamlit Cloud:
- Push the latest code to GitHub.
- Set
GROQ_API_KEYin Streamlit Cloud secrets. - Do not upload
.env. - Make sure
requirements.txt,app/streamlit_app.py,src/,config.yaml, and project modules are pushed.
Example Streamlit secret:
GROQ_API_KEY = "your_groq_api_key"Agentic-ML-Audit-Copilot/
├── app/
│ ├── api.py
│ └── streamlit_app.py
├── src/
│ ├── audit/
│ └── utils/
├── tests/
├── docs/
├── assets/
│ ├── architecture/
│ ├── branding/
│ ├── demo/
│ └── screenshots/
├── data/
│ └── sample/
├── reports/
├── artifacts/
├── logs/
├── .github/
├── .streamlit/
├── config.yaml
├── pyproject.toml
├── requirements.txt
├── pytest.ini
├── Dockerfile
├── DOCKER.md
├── README.md
├── CHANGELOG.md
├── CONTRIBUTING.md
├── CODE_OF_CONDUCT.md
├── SECURITY.md
└── LICENSE.md
| Document | Purpose |
|---|---|
docs/ARCHITECTURE.md |
System architecture and workflow design |
docs/API.md |
FastAPI endpoint guide |
docs/USAGE.md |
Streamlit app and API usage guide |
docs/TESTING.md |
Testing strategy and commands |
docs/KNOWN_LIMITATIONS.md |
Known limitations and scope boundaries |
docs/ROADMAP.md |
Planned improvements |
docs/PROJECT_REVIEW.md |
Portfolio-level project review |
docs/ASSETS.md |
Asset and screenshot guide |
DOCKER.md |
Docker build, run, and publish guide |
CHANGELOG.md |
Release history |
CONTRIBUTING.md |
Contribution guidelines |
CODE_OF_CONDUCT.md |
Community rules |
SECURITY.md |
Security policy |
LICENSE.md |
License details |
- LangGraph-based audit workflow
- Parallel deterministic audit checks
- Risk Aggregator and Decision Router
- Human Review Gate for risky datasets
- Reviewer decision export as JSON
- FastAPI backend with Swagger documentation
- Streamlit dashboard with audit tabs and downloads
- Baseline model benchmarking
- MLflow experiment tracking
- SHAP and built-in feature importance support
- LLM-based audit report and Q&A
- JSON-safe API responses
- Configuration-driven behavior
- Centralized logging and exception handling
- pytest test suite
- Ruff linting and formatting
- Dockerized local deployment
- Streamlit Cloud deployment
- GitHub Actions CI support
This project currently focuses on:
- CSV datasets
- Tabular ML
- Classification and regression
- Single-machine execution
- Baseline model benchmarking
- Pre-training audit and review
It is not a replacement for:
- Full enterprise data governance
- Security review
- Production monitoring
- Fairness certification
- Model approval boards
- AutoML systems
- Production model serving platforms
Planned improvements:
- Data drift detection
- Feature drift detection
- Fairness and bias analysis
- Hyperparameter optimization
- PDF reports
- HTML reports
- Polars support
- Dask support
- Authentication
- Team workspaces
- Kubernetes deployment
- Cloud deployment templates
Contributions are welcome.
Before opening a pull request:
uv run ruff check . --fix --unsafe-fixes
uv run ruff format .
uv run pytest -qPlease read:
CONTRIBUTING.md
CODE_OF_CONDUCT.md
Do not commit secrets.
Use:
.env.example
for documenting required variables.
Use environment variables or platform secrets for real API keys.
This project is released under the MIT License.
See:
LICENSE.md
Shivam Rajput
Data Science | Machine Learning | MLOps | Agentic AI
- Portfolio:
https://shivamrajput-ds.github.io/portfolio-website/ - GitHub:
https://github.com/shivamrajput-ds - LinkedIn:
https://www.linkedin.com/in/shivam-rajput-ds/ - Docker Hub:
https://hub.docker.com/r/shivamrajput130/agentic-ml-audit-copilot - YouTube:
https://youtu.be/kFzNam74QBc - Kaggle:
https://www.kaggle.com/shivamja - LeetCode:
https://leetcode.com/u/ShivamSynapse/ - X:
https://x.com/ShivamR65014299
Agentic ML Audit Copilot
Python • scikit-learn • FastAPI • Streamlit • LangGraph • MLflow • SHAP • Docker • Groq








