CompAgent: An Agentic Framework for Visual Compliance Verification
4
stars
3
commits
Jupyter Notebook
primary language
May 18, 2026
updated
Rahul Ghosh, Baishali Chaudhury, Hari Prasanna Das, Meghana Ashok, Ryan Razkenari, Long Chen, Sungmin Hong, Chun-Hao Liu
Accepted at CVPR 2026 GRAIL-V (Grounded Retrieval and Agentic Intelligence for Vision-Language) Workshop
⚠️ Notice: This code is being released solely for academic and scientific reproducibility purposes, in support of the methods and findings described in the associated publication. Pull requests are not being accepted in order to maintain the code exactly as it was used in the paper.
CompAgent is the first agentic framework for visual compliance verification — a critical yet underexplored problem in computer vision, especially in domains such as media, entertainment, and advertising where content must adhere to complex and evolving policy rules.
Existing methods often rely on task-specific deep learning models trained on manually labeled datasets, which are costly to build and limited in generalizability. While recent Multimodal Large Language Models (MLLMs) offer broad real-world knowledge and policy understanding, they struggle to reason over fine-grained visual details and apply structured compliance rules effectively on their own.
CompAgent addresses this by augmenting MLLMs with a suite of specialized visual tools — including Amazon Rekognition, Bedrock Data Automation (BDA), LlavaGuard, SafeCLIP, and ICM-Assistant — and introduces a planning agent built on LangGraph that dynamically selects appropriate tools based on the compliance policy. A compliance verification agent then integrates image content, tool outputs, and policy context to perform multimodal reasoning using a ReAct (Reasoning + Acting) paradigm.
Key Results:
Figure: Overview of the CompAgent framework. A planning agent dynamically selects visual tools based on the compliance policy, and a compliance verification agent integrates multimodal evidence to produce structured safety assessments.
Demo: CompAgent in action — dynamically selecting tools and performing visual compliance verification.
CompAgent includes an interactive Streamlit UI that provides a lightweight interface to run the LangGraph ReAct agent for image compliance checking with real-time execution trace visualization.
Ensure metadata is extracted (see Step 1 below)
Navigate to the agent directory:
cd src/agent
Run the Streamlit app:
streamlit run streamlit_app.py
Open your browser at http://localhost:8501
The app automatically detects the dataset configuration from BUCKET_NAME in compliance_tools_standalone_langgraph.py:
llavaguard_agent.txt promptunsafebench_agent.txt promptgrip-compagent/
├── README.md # This file
├── requirements.txt # Python dependencies (pip)
├── pyproject.toml # Project configuration (uv)
├── assets/
│ ├── main_architecture.png # Architecture diagram
│ ├── demo.gif # Demo GIF (for README)
│ └── demo_video.mp4 # Full demo video
├── src/
│ ├── agent/ # 🧠 Main CompAgent Framework
│ │ ├── langGraph_reAct_llavaguard.ipynb # LangGraph ReAct agent for LlavaGuard benchmark
│ │ ├── langGraph_reAct_unsafebench.ipynb # LangGraph ReAct agent for UnsafeBench benchmark
│ │ ├── compliance_tools_standalone_langgraph.py # Tool definitions for the agent
│ │ ├── streamlit_app.py # Interactive Streamlit demo UI
│ │ ├── run_notebook.sh # Shell script to execute the notebook
│ │ └── prompt/ # Agent system prompts
│ │ ├── llavaguard_agent.txt # LlavaGuard policy prompt for agent
│ │ ├── llavaguard.txt # LlavaGuard standalone prompt
│ │ ├── unsafebench_agent.txt # UnsafeBench policy prompt for agent
│ │ └── unsafebench.txt # UnsafeBench standalone prompt
│ ├── tool_run/ # 🔧 Standalone Tool Runners
│ │ ├── tool_llavaguard.py # Run LlavaGuard inference on images
│ │ ├── tool_BDA.py # Run Bedrock Data Automation on images
│ │ ├── tool_rekognition.py # Run Amazon Rekognition on images
│ │ ├── tool_safeclip.py # Run SafeCLIP on images
│ │ ├── tool_icm.py # Run ICM-Assistant on images
│ │ ├── config_icm.yaml # ICM-Assistant model/runtime config
│ │ └── prompts_icm.yaml # ICM-Assistant prompt templates
│ ├── baseline_run/ # 📊 Baseline Comparisons
│ │ ├── run_llama_baseline.ipynb # Llama baseline
│ │ ├── run_mistral_baseline.ipynb # Mistral/Pixtral baseline
│ │ ├── run_sonnet_baseline.ipynb # Claude Sonnet baseline
│ │ └── run_notebooks.sh # Run all baselines
│ ├── evaluation/ # 📈 Evaluation Notebooks
│ │ ├── evaluation.ipynb # General evaluation
│ │ ├── evaluation-llavaguard.ipynb# LlavaGuard benchmark evaluation
│ │ └── evaluation-unsafebench.ipynb # UnsafeBench benchmark evaluation
│ ├── prompts/ # 📝 System Prompts
│ │ ├── prompt_agent_system_w_verification.txt
│ │ ├── prompt_cluster_routing.txt
│ │ └── prompt_llavaguard.txt
│ ├── routing/ # 🔀 Routing Logic
│ │ ├── compliance_state.py # Compliance state definitions
│ │ ├── compliance_tools.py # Tool routing implementations
│ │ └── routing_decisions.txt # Routing decision documentation
│ └── utils/ # 🛠️ Utilities
│ ├── bedrock_invoker.py # AWS Bedrock API wrapper
│ ├── helpers.py # General helper functions
│ ├── inference_helpers.py # Inference utility functions
│ └── openai_clip.py # OpenAI CLIP utilities
Clone the repository:
git clone https://gitlab.aws.dev/genaiic-reusable-assets/other/grip-compagent
cd grip-compagent
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Install ICM-Assistant (LLaVA):
ICM-Assistant depends on the LLaVA package. Create the icm-assistant folder inside src/tool_run/, clone LLaVA into it, and install:
mkdir -p src/tool_run/icm-assistant
cd src/tool_run/icm-assistant
git clone https://github.com/haotian-liu/LLaVA.git
cd LLaVA
pip install -e .
cd ../../../..
The ICM model used is
liuhaotian/llava-v1.6-mistral-7b(or as configured insrc/tool_run/config_icm.yaml). It will be downloaded automatically by thetransformerslibrary on first run.
Alternatively, you can use uv for faster dependency management:
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
Install dependencies and sync environment:
uv sync
Activate the virtual environment:
source .venv/bin/activate
Install ICM-Assistant (LLaVA):
ICM-Assistant depends on the LLaVA package. Create the icm-assistant folder inside src/tool_run/, clone LLaVA into it, and install:
mkdir -p src/tool_run/icm-assistant
cd src/tool_run/icm-assistant
git clone https://github.com/haotian-liu/LLaVA.git
cd LLaVA
pip install -e .
cd ../../../..
The ICM model used is
liuhaotian/llava-v1.6-mistral-7b(or as configured insrc/tool_run/config_icm.yaml). It will be downloaded automatically by thetransformerslibrary on first run.
Configure AWS credentials:
export AWS_PROFILE=your-profile
# or
export AWS_ACCESS_KEY_ID=your-key
export AWS_SECRET_ACCESS_KEY=your-secret
export AWS_DEFAULT_REGION=us-east-1
CompAgent is evaluated on two public safety benchmarks. You will need to obtain the datasets and upload them to an S3 bucket.
| Benchmark | Task | Categories | Source |
|---|---|---|---|
| LlavaGuard | 9-category safety classification | Hate, Violence, Sexual, Nudity, Criminal, Weapons, Self-Harm, Animal Cruelty, Disasters | LlavaGuard (arXiv:2406.05113) |
| UnsafeBench | Binary safe/unsafe classification | 12 unsafe categories | UnsafeBench (arXiv:2405.11116) |
Create an S3 bucket and upload your images:
# Create bucket
aws s3 mb s3://your-bucket-name --region us-east-1
# Upload images for LlavaGuard benchmark
aws s3 cp ./your-images/ s3://your-bucket-name/testset/ --recursive
# Or for UnsafeBench benchmark
aws s3 cp ./your-images/ s3://your-bucket-name/test/images/ --recursive
Update the BUCKET_NAME variable in src/agent/compliance_tools_standalone_langgraph.py to match your bucket name.
Note: The SafeCLIP tool (
src/utils/openai_clip.py) will download the HQ-CLIP model (~1.7 GB) from HuggingFace on first run.
Before running the CompAgent framework, you need to extract metadata from images using the standalone tools in src/tool_run/. Each tool processes images from an S3 bucket and uploads the resulting metadata back to S3 directly.
python src/tool_run/tool_llavaguard.py \
--s3_image_path s3://your-bucket/testset/ \
--s3_output s3://your-bucket/llavaguard_metadata/
python src/tool_run/tool_BDA.py \
--bucket_name your-bucket-name \
--prefix_input testset \
--prefix_output BDA_metadata
python src/tool_run/tool_rekognition.py \
--bucket_name your-bucket-name \
--prefix_input testset \
--prefix_output rekognition_metadata
ICM-Assistant uses the ICM-LLaVA model for image content moderation with configurable prompts via YAML.
Basic S3 Usage:
python src/tool_run/tool_icm.py \
--s3_image_path s3://your-bucket/testset/ \
--s3_output s3://your-bucket/icm_assistant_metadata/
Local folder processing:
python src/tool_run/tool_icm.py \
--local_image_folder ./input_images \
--local_output ./icm_metadata
Using different prompts (configured in prompts_icm.yaml):
# Use UnsafeBench 12-category prompt
python src/tool_run/tool_icm.py \
--s3_image_path s3://your-bucket/testset/ \
--s3_output s3://your-bucket/icm_metadata/ \
--prompt_name unsafe_bench
# Available: llava_default, unsafe_bench, simple, violence_only, nsfw
Note:
- ICM-Assistant requires the LLaVA package. Create the
icm-assistantfolder and install:mkdir -p src/tool_run/icm-assistant && cd src/tool_run/icm-assistant && git clone https://github.com/haotian-liu/LLaVA.git && cd LLaVA && pip install -e .- Configuration files:
src/tool_run/config_icm.yamlandsrc/tool_run/prompts_icm.yaml
python src/tool_run/tool_safeclip.py \
--s3_image_path s3://your-bucket/testset/ \
--s3_output s3://your-bucket/safeclip_metadata/
Refer to the SafeCLIP integration in
src/utils/openai_clip.pyfor zero-shot toxic image detection.
After running all tools, the extracted metadata (JSON files) will be available in S3 under their respective prefixes:
s3://your-bucket-name/
├── testset/ # Input images
├── tools/
│ ├── rekognition_metadata/ # Rekognition output (faces, labels, moderation, text)
│ ├── BDA_metadata/ # BDA output (summary, IAB categories, moderation)
│ ├── llavaguard_metadata/ # LlavaGuard output (rating, category, rationale)
│ ├── icm_assistant_metadata/ # ICM-Assistant output
│ ├── safeclip_prompting_results/ # SafeCLIP output (safe/unsafe scores)
│ ├── llavaguard_validation/ # (Optional) LlavaGuard validation confidence scores
│ ├── safeclip_validation/ # (Optional) SafeCLIP validation confidence scores
│ └── icm_assistant_validation/ # (Optional) ICM validation confidence scores
└── merged_test_with_s3.csv # Ground truth CSV (id, s3_location, policy, label)
Note: The
*_validation/prefixes are optional. If not present, the agent tools will still function but without confidence validation scores.
Once metadata is extracted and uploaded to S3, you can run the main CompAgent framework using the LangGraph ReAct agent.
For the LlavaGuard benchmark (9-category classification):
cd src/agent
jupyter notebook langGraph_reAct_llavaguard.ipynb
For the UnsafeBench benchmark (binary safe/unsafe classification):
cd src/agent
jupyter notebook langGraph_reAct_unsafebench.ipynb
cd src/agent
bash run_notebook.sh
This will:
After running the CompAgent framework, use the evaluation notebooks to compute metrics, generate classification reports, and analyze policy responsiveness.
cd src/evaluation
jupyter notebook evaluate.ipynb
This is the primary evaluation notebook that provides comprehensive analysis including:
Overall Evaluation:
Category-wise Evaluation:
Policy Responsiveness Analysis:
cd src/evaluation
jupyter notebook evaluation-llavaguard.ipynb
This notebook evaluates 9-category safety classification:
cd src/evaluation
jupyter notebook evaluation-unsafebench.ipynb
This notebook evaluates binary safe/unsafe classification:
| Metric | Description |
|---|---|
| Precision | True positives / (True positives + False positives) |
| Recall | True positives / (True positives + False negatives) |
| F1 Score | Harmonic mean of Precision and Recall |
| Accuracy | Overall correct predictions / Total predictions |
| Balanced Accuracy | Average of recall for each class (handles imbalance) |
| PER | Policy Exception Rate — accuracy on policy-sensitive images |
| PES | Policy Exception Score — harmonic mean of PER and Balanced Accuracy |
Note: The evaluation notebooks require
numpy,scikit-learn,seaborn, andmatplotlib, which are included inrequirements.txt.
The authors would like to thank their colleague Isaac Privitera for his thorough review and insightful feedback, which significantly improved the quality and clarity of this research. They also acknowledge the leadership team of Vidya Sagar Ravipati, Wan Chen, Anila Joshi, Atanu Roy, Sri Elaprolu, and Taimur Rashid for their guidance and support on this research.
If you find this work useful, please cite our paper:
📎 Paper: https://arxiv.org/abs/2511.00171
@inproceedings{ghosh2026compagent,
title={CompAgent: An Agentic Framework for Visual Compliance Verification},
author={Ghosh, Rahul and Chaudhury, Baishali and Das, Hari Prasanna and Ashok, Meghana and Razkenari, Ryan and Chen, Long and Hong, Sungmin and Liu, Chun-Hao},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
note={GRAIL-V Workshop},
year={2026}
}
⭐ If you find this project helpful, please consider giving it a star!
2 commits
1 commits
Jupyter Notebook
56.4%
Python
43.2%
CompAgent: An Agentic Framework for Visual Compliance Verification
4
stars
3
commits
Jupyter Notebook
primary language
May 18, 2026
updated
Rahul Ghosh, Baishali Chaudhury, Hari Prasanna Das, Meghana Ashok, Ryan Razkenari, Long Chen, Sungmin Hong, Chun-Hao Liu
Accepted at CVPR 2026 GRAIL-V (Grounded Retrieval and Agentic Intelligence for Vision-Language) Workshop
⚠️ Notice: This code is being released solely for academic and scientific reproducibility purposes, in support of the methods and findings described in the associated publication. Pull requests are not being accepted in order to maintain the code exactly as it was used in the paper.
CompAgent is the first agentic framework for visual compliance verification — a critical yet underexplored problem in computer vision, especially in domains such as media, entertainment, and advertising where content must adhere to complex and evolving policy rules.
Existing methods often rely on task-specific deep learning models trained on manually labeled datasets, which are costly to build and limited in generalizability. While recent Multimodal Large Language Models (MLLMs) offer broad real-world knowledge and policy understanding, they struggle to reason over fine-grained visual details and apply structured compliance rules effectively on their own.
CompAgent addresses this by augmenting MLLMs with a suite of specialized visual tools — including Amazon Rekognition, Bedrock Data Automation (BDA), LlavaGuard, SafeCLIP, and ICM-Assistant — and introduces a planning agent built on LangGraph that dynamically selects appropriate tools based on the compliance policy. A compliance verification agent then integrates image content, tool outputs, and policy context to perform multimodal reasoning using a ReAct (Reasoning + Acting) paradigm.
Key Results:
Figure: Overview of the CompAgent framework. A planning agent dynamically selects visual tools based on the compliance policy, and a compliance verification agent integrates multimodal evidence to produce structured safety assessments.
Demo: CompAgent in action — dynamically selecting tools and performing visual compliance verification.
CompAgent includes an interactive Streamlit UI that provides a lightweight interface to run the LangGraph ReAct agent for image compliance checking with real-time execution trace visualization.
Ensure metadata is extracted (see Step 1 below)
Navigate to the agent directory:
cd src/agent
Run the Streamlit app:
streamlit run streamlit_app.py
Open your browser at http://localhost:8501
The app automatically detects the dataset configuration from BUCKET_NAME in compliance_tools_standalone_langgraph.py:
llavaguard_agent.txt promptunsafebench_agent.txt promptgrip-compagent/
├── README.md # This file
├── requirements.txt # Python dependencies (pip)
├── pyproject.toml # Project configuration (uv)
├── assets/
│ ├── main_architecture.png # Architecture diagram
│ ├── demo.gif # Demo GIF (for README)
│ └── demo_video.mp4 # Full demo video
├── src/
│ ├── agent/ # 🧠 Main CompAgent Framework
│ │ ├── langGraph_reAct_llavaguard.ipynb # LangGraph ReAct agent for LlavaGuard benchmark
│ │ ├── langGraph_reAct_unsafebench.ipynb # LangGraph ReAct agent for UnsafeBench benchmark
│ │ ├── compliance_tools_standalone_langgraph.py # Tool definitions for the agent
│ │ ├── streamlit_app.py # Interactive Streamlit demo UI
│ │ ├── run_notebook.sh # Shell script to execute the notebook
│ │ └── prompt/ # Agent system prompts
│ │ ├── llavaguard_agent.txt # LlavaGuard policy prompt for agent
│ │ ├── llavaguard.txt # LlavaGuard standalone prompt
│ │ ├── unsafebench_agent.txt # UnsafeBench policy prompt for agent
│ │ └── unsafebench.txt # UnsafeBench standalone prompt
│ ├── tool_run/ # 🔧 Standalone Tool Runners
│ │ ├── tool_llavaguard.py # Run LlavaGuard inference on images
│ │ ├── tool_BDA.py # Run Bedrock Data Automation on images
│ │ ├── tool_rekognition.py # Run Amazon Rekognition on images
│ │ ├── tool_safeclip.py # Run SafeCLIP on images
│ │ ├── tool_icm.py # Run ICM-Assistant on images
│ │ ├── config_icm.yaml # ICM-Assistant model/runtime config
│ │ └── prompts_icm.yaml # ICM-Assistant prompt templates
│ ├── baseline_run/ # 📊 Baseline Comparisons
│ │ ├── run_llama_baseline.ipynb # Llama baseline
│ │ ├── run_mistral_baseline.ipynb # Mistral/Pixtral baseline
│ │ ├── run_sonnet_baseline.ipynb # Claude Sonnet baseline
│ │ └── run_notebooks.sh # Run all baselines
│ ├── evaluation/ # 📈 Evaluation Notebooks
│ │ ├── evaluation.ipynb # General evaluation
│ │ ├── evaluation-llavaguard.ipynb# LlavaGuard benchmark evaluation
│ │ └── evaluation-unsafebench.ipynb # UnsafeBench benchmark evaluation
│ ├── prompts/ # 📝 System Prompts
│ │ ├── prompt_agent_system_w_verification.txt
│ │ ├── prompt_cluster_routing.txt
│ │ └── prompt_llavaguard.txt
│ ├── routing/ # 🔀 Routing Logic
│ │ ├── compliance_state.py # Compliance state definitions
│ │ ├── compliance_tools.py # Tool routing implementations
│ │ └── routing_decisions.txt # Routing decision documentation
│ └── utils/ # 🛠️ Utilities
│ ├── bedrock_invoker.py # AWS Bedrock API wrapper
│ ├── helpers.py # General helper functions
│ ├── inference_helpers.py # Inference utility functions
│ └── openai_clip.py # OpenAI CLIP utilities
Clone the repository:
git clone https://gitlab.aws.dev/genaiic-reusable-assets/other/grip-compagent
cd grip-compagent
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Install ICM-Assistant (LLaVA):
ICM-Assistant depends on the LLaVA package. Create the icm-assistant folder inside src/tool_run/, clone LLaVA into it, and install:
mkdir -p src/tool_run/icm-assistant
cd src/tool_run/icm-assistant
git clone https://github.com/haotian-liu/LLaVA.git
cd LLaVA
pip install -e .
cd ../../../..
The ICM model used is
liuhaotian/llava-v1.6-mistral-7b(or as configured insrc/tool_run/config_icm.yaml). It will be downloaded automatically by thetransformerslibrary on first run.
Alternatively, you can use uv for faster dependency management:
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
Install dependencies and sync environment:
uv sync
Activate the virtual environment:
source .venv/bin/activate
Install ICM-Assistant (LLaVA):
ICM-Assistant depends on the LLaVA package. Create the icm-assistant folder inside src/tool_run/, clone LLaVA into it, and install:
mkdir -p src/tool_run/icm-assistant
cd src/tool_run/icm-assistant
git clone https://github.com/haotian-liu/LLaVA.git
cd LLaVA
pip install -e .
cd ../../../..
The ICM model used is
liuhaotian/llava-v1.6-mistral-7b(or as configured insrc/tool_run/config_icm.yaml). It will be downloaded automatically by thetransformerslibrary on first run.
Configure AWS credentials:
export AWS_PROFILE=your-profile
# or
export AWS_ACCESS_KEY_ID=your-key
export AWS_SECRET_ACCESS_KEY=your-secret
export AWS_DEFAULT_REGION=us-east-1
CompAgent is evaluated on two public safety benchmarks. You will need to obtain the datasets and upload them to an S3 bucket.
| Benchmark | Task | Categories | Source |
|---|---|---|---|
| LlavaGuard | 9-category safety classification | Hate, Violence, Sexual, Nudity, Criminal, Weapons, Self-Harm, Animal Cruelty, Disasters | LlavaGuard (arXiv:2406.05113) |
| UnsafeBench | Binary safe/unsafe classification | 12 unsafe categories | UnsafeBench (arXiv:2405.11116) |
Create an S3 bucket and upload your images:
# Create bucket
aws s3 mb s3://your-bucket-name --region us-east-1
# Upload images for LlavaGuard benchmark
aws s3 cp ./your-images/ s3://your-bucket-name/testset/ --recursive
# Or for UnsafeBench benchmark
aws s3 cp ./your-images/ s3://your-bucket-name/test/images/ --recursive
Update the BUCKET_NAME variable in src/agent/compliance_tools_standalone_langgraph.py to match your bucket name.
Note: The SafeCLIP tool (
src/utils/openai_clip.py) will download the HQ-CLIP model (~1.7 GB) from HuggingFace on first run.
Before running the CompAgent framework, you need to extract metadata from images using the standalone tools in src/tool_run/. Each tool processes images from an S3 bucket and uploads the resulting metadata back to S3 directly.
python src/tool_run/tool_llavaguard.py \
--s3_image_path s3://your-bucket/testset/ \
--s3_output s3://your-bucket/llavaguard_metadata/
python src/tool_run/tool_BDA.py \
--bucket_name your-bucket-name \
--prefix_input testset \
--prefix_output BDA_metadata
python src/tool_run/tool_rekognition.py \
--bucket_name your-bucket-name \
--prefix_input testset \
--prefix_output rekognition_metadata
ICM-Assistant uses the ICM-LLaVA model for image content moderation with configurable prompts via YAML.
Basic S3 Usage:
python src/tool_run/tool_icm.py \
--s3_image_path s3://your-bucket/testset/ \
--s3_output s3://your-bucket/icm_assistant_metadata/
Local folder processing:
python src/tool_run/tool_icm.py \
--local_image_folder ./input_images \
--local_output ./icm_metadata
Using different prompts (configured in prompts_icm.yaml):
# Use UnsafeBench 12-category prompt
python src/tool_run/tool_icm.py \
--s3_image_path s3://your-bucket/testset/ \
--s3_output s3://your-bucket/icm_metadata/ \
--prompt_name unsafe_bench
# Available: llava_default, unsafe_bench, simple, violence_only, nsfw
Note:
- ICM-Assistant requires the LLaVA package. Create the
icm-assistantfolder and install:mkdir -p src/tool_run/icm-assistant && cd src/tool_run/icm-assistant && git clone https://github.com/haotian-liu/LLaVA.git && cd LLaVA && pip install -e .- Configuration files:
src/tool_run/config_icm.yamlandsrc/tool_run/prompts_icm.yaml
python src/tool_run/tool_safeclip.py \
--s3_image_path s3://your-bucket/testset/ \
--s3_output s3://your-bucket/safeclip_metadata/
Refer to the SafeCLIP integration in
src/utils/openai_clip.pyfor zero-shot toxic image detection.
After running all tools, the extracted metadata (JSON files) will be available in S3 under their respective prefixes:
s3://your-bucket-name/
├── testset/ # Input images
├── tools/
│ ├── rekognition_metadata/ # Rekognition output (faces, labels, moderation, text)
│ ├── BDA_metadata/ # BDA output (summary, IAB categories, moderation)
│ ├── llavaguard_metadata/ # LlavaGuard output (rating, category, rationale)
│ ├── icm_assistant_metadata/ # ICM-Assistant output
│ ├── safeclip_prompting_results/ # SafeCLIP output (safe/unsafe scores)
│ ├── llavaguard_validation/ # (Optional) LlavaGuard validation confidence scores
│ ├── safeclip_validation/ # (Optional) SafeCLIP validation confidence scores
│ └── icm_assistant_validation/ # (Optional) ICM validation confidence scores
└── merged_test_with_s3.csv # Ground truth CSV (id, s3_location, policy, label)
Note: The
*_validation/prefixes are optional. If not present, the agent tools will still function but without confidence validation scores.
Once metadata is extracted and uploaded to S3, you can run the main CompAgent framework using the LangGraph ReAct agent.
For the LlavaGuard benchmark (9-category classification):
cd src/agent
jupyter notebook langGraph_reAct_llavaguard.ipynb
For the UnsafeBench benchmark (binary safe/unsafe classification):
cd src/agent
jupyter notebook langGraph_reAct_unsafebench.ipynb
cd src/agent
bash run_notebook.sh
This will:
After running the CompAgent framework, use the evaluation notebooks to compute metrics, generate classification reports, and analyze policy responsiveness.
cd src/evaluation
jupyter notebook evaluate.ipynb
This is the primary evaluation notebook that provides comprehensive analysis including:
Overall Evaluation:
Category-wise Evaluation:
Policy Responsiveness Analysis:
cd src/evaluation
jupyter notebook evaluation-llavaguard.ipynb
This notebook evaluates 9-category safety classification:
cd src/evaluation
jupyter notebook evaluation-unsafebench.ipynb
This notebook evaluates binary safe/unsafe classification:
| Metric | Description |
|---|---|
| Precision | True positives / (True positives + False positives) |
| Recall | True positives / (True positives + False negatives) |
| F1 Score | Harmonic mean of Precision and Recall |
| Accuracy | Overall correct predictions / Total predictions |
| Balanced Accuracy | Average of recall for each class (handles imbalance) |
| PER | Policy Exception Rate — accuracy on policy-sensitive images |
| PES | Policy Exception Score — harmonic mean of PER and Balanced Accuracy |
Note: The evaluation notebooks require
numpy,scikit-learn,seaborn, andmatplotlib, which are included inrequirements.txt.
The authors would like to thank their colleague Isaac Privitera for his thorough review and insightful feedback, which significantly improved the quality and clarity of this research. They also acknowledge the leadership team of Vidya Sagar Ravipati, Wan Chen, Anila Joshi, Atanu Roy, Sri Elaprolu, and Taimur Rashid for their guidance and support on this research.
If you find this work useful, please cite our paper:
📎 Paper: https://arxiv.org/abs/2511.00171
@inproceedings{ghosh2026compagent,
title={CompAgent: An Agentic Framework for Visual Compliance Verification},
author={Ghosh, Rahul and Chaudhury, Baishali and Das, Hari Prasanna and Ashok, Meghana and Razkenari, Ryan and Chen, Long and Hong, Sungmin and Liu, Chun-Hao},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
note={GRAIL-V Workshop},
year={2026}
}
⭐ If you find this project helpful, please consider giving it a star!
2 commits
1 commits
Jupyter Notebook
56.4%
Python
43.2%