End-to-end toolkit for analyzing AI/ML supply-chain bills of materials (AI BOMs).
It mirrors the SBOM workflow from canon_urop/node_exploitability but swaps in
an AI-specific graph generator, Monte Carlo risk simulator, and image pipeline
tuned to the α-weight vector [0.10, 0.15, 0.15, 0.30, 0.30] (CVEs, Misconfigs,
WeakControls, 1 - DataQuality, Exploitability).
ai_bom/ # Core Python modules
├─ ai_graph_generator.py # Builds AI/ML dependency graphs
├─ ai_unweighted_top20.py # Unweighted betweenness + PageRank plots
├─ ai_weighted_monte_carlo.py # Weighted Monte Carlo simulations (25k trials)
├─ ai_image_creation.py # HTML → PNG conversion via Playwright
└─ ai_graph_visualization.py # Pyvis network view (AI_BOM_graph.html)
ai_outputs/ # HTML + CSV outputs (graph viz, plots, summaries)
ai_images/ # Final PNG snapshots (8 total: weighted/unweighted x 2 metrics)
README.md # You are here
LICENSE # MIT
cd /Users/yaphetlemiesa/UROP_2025_fall/ai-bom-analysis
python3 -m venv .venv && source .venv/bin/activate # optional but recommended
pip install --upgrade pip
pip install -r requirements.txt
playwright install chromiumrequirements.txt tracks the packages this toolkit actually imports (including
pillow, needed by ai_bom/create_multisize_2x8_grid.py and
ai_bom/create_plot_grid.py for the PNG grid assembly, which the old inline
pip command here omitted). tqdm was listed previously but isn't imported
anywhere in ai_bom/, so it's been dropped.
- Playwright is required for
ai_image_creation.py. Runningplaywright install chromiumonce per machine resolves thesync_playwrightimport error. - If you plan to rerun Monte Carlo simulations, be sure the environment has enough RAM; 5,000 weighted runs on a 500-node graph take ~5 minutes on a modern laptop.
-
Interactive Graph (AI vs SBOM parity)
python -m ai_bom.ai_graph_visualization \ --distribution lognormal # edit inside file if you prefer paretoOutput:
ai_outputs/AI_BOM_graph.html -
Unweighted Top-20 Rankings (lognormal + pareto)
python -m ai_bom.ai_unweighted_top20
Outputs per distribution:
top20_betweenness_bar.html+ CSV snapshottop20_pagerank_bar.html+ CSV snapshot
-
Weighted Monte Carlo (25k sims, α=[0.10,0.15,0.15,0.30,0.30])
python -m ai_bom.ai_weighted_monte_carlo
Creates for each distribution (lognormal & pareto):
- Betweenness/PageRank box plots (
montecarlo_*_25000/*.html) - Samples + summary CSVs
- Ranked top-20 box plots (
*_top20_ranked.html)
- Betweenness/PageRank box plots (
-
Screenshot Pipeline (8 PNGs)
python -m ai_bom.ai_image_creation
Converts the deterministic HTML filenames above into PNGs under
ai_images/(unweighted & weighted × betweenness & PageRank).
ai_outputs/AI_BOM_graph.html– interactive Pyvis visualization of the AI BOM network.ai_outputs/unweighted/<dist>/top20_*– bar charts + CSVs for betweenness/PageRank.ai_outputs/weighted/<dist>/montecarlo_*_25000/– Monte Carlo diagnostics, summary stats, and top-20 ranked box plots.ai_images/*.png– final eight images ready for reports:unweighted_betweenness_lognormal.pngunweighted_betweenness_pareto.pngunweighted_pagerank_lognormal.pngunweighted_pagerank_pareto.pngweighted_betweenness_lognormal.pngweighted_betweenness_pareto.pngweighted_pagerank_lognormal.pngweighted_pagerank_pareto.png
- Playwright import error → run
pip install playwrightandplaywright install chromium. - HTML not found during screenshot step → ensure the unweighted/weighted scripts were run first; the screenshot script expects fixed filenames.
- Long Monte Carlo runtimes → lower
n_simulationsinsideai_weighted_monte_carlo.pyor run one distribution at a time by editing thefor dist in (...)loop.
- Add CLI arguments (e.g.,
--distribution,--n-simulations) for finer-grained control. - Wire the outputs into downstream reporting notebooks or dashboards.
Questions? Ping email yaphet.lemiesa@gmail.com