Skip to content

Enhance FAISS index handling and UI for MIT AI Risk Repository - #27

Open
aravind-3105 wants to merge 16 commits into
mainfrom
data/mit-ai-risks-v4
Open

aravind-3105 wants to merge 16 commits into
mainfrom
data/mit-ai-risks-v4

Conversation

@aravind-3105

Copy link
Copy Markdown
Member

Summary

Ship MIT AI Risk Repository V4 in the bundled FAISS indexes (1,538 risks / expanded RMF metadata), fix per-risk RMF lookups (no duplicate GOVERN spam), expose corpus version on health, and upgrade the web UI for risk batch runs, exports, RMF disclosures, and more reliable single-run streaming. Bumps package version to 0.3.0. JOSS paper remains tied to V3 counts; cite Zenodo per release for reproducible V4 data.

Clickup Ticket(s): N/A

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test improvements
  • 🔒 Security fix

Changes Made

  • Data / indexes: V3/V4 MIT CSV transform, FAISS rebuild with optional --device, sync into fairsense_agentix/data/indexes/; risk_corpus.py metadata for V4.
  • Risk / RMF: rmf_lookup.py + retrieval changes so RMF actions resolve by MIT risk id instead of global FAISS neighbors; illustrative NIST template disclaimer.
  • API: Health includes software_version, MIT corpus version, snapshot date, indexed risk count; RiskResult.joined_table for exports.
  • UI: Vite /v1 proxy; batch POST + CSV upload, progress, JSON/CSV export; risk dedupe, corpus badge, RMF tooltips; About modal index info; in-progress panel + WebSocket hardening; failed bias runs show errors/warnings.
  • Tooling / docs: mit-risk-index.md, DATA_FORMAT / user guide updates; examples/batch_risk_scenarios.csv; gitignore for local/ / .env.vector.
  • Version: 0.3.0 + uv.lock sync.

Testing

  • Tests pass locally (uv run pytest tests/)
  • Type checking passes (uv run mypy <src_dir>)
  • Linting passes (uv run ruff check src_dir/)
  • Manual testing performed (describe below)

Manual testing details:

  • Login node: python -m fairsense_agentix.service_api + cd ui && npm run dev (Vite proxy, single port 5173).
  • Risk (single): V4 corpus badge, deduplicated top risks, per-risk RMF cards (no triple GOVERN).
  • Risk (batch): examples/batch_risk_scenarios.csv, progress bar, combined JSON/CSV export.
  • Bias (text): WebSocket timeline through completion; failed LLM config shows errors in UI (not empty panel).
  • Health: /v1/health shows version and MIT index metadata.

Screenshots/Recordings

  • Optional: batch risk export CSV, risk tab with RMF section, bias error panel after misconfigured key.

Related Issues

Relates to MIT AI Risk Repository V4 indexing and post-JOSS release 0.3.0 (Zenodo DOI when tagged).

Deployment Notes

  • Bundled index size increases (FAISS + JSON metadata); first pip/install or clone pull is heavier.
  • Existing installs need package update to pick up new fairsense_agentix/data/indexes/*.
  • Rebuild from source: scripts/transform_mit_data.py → build_faiss_indexes.py → sync_package_indexes.py (see docs).
  • JOSS paper/ intentionally not updated for V4 row counts.
  • UI: omit VITE_API_BASE when using dev proxy; on HPC use module load nodejs (not ~/.local/bin/node).
  • LLM keys stay in gitignored .env only (not committed).

Checklist

  • Code follows the project's style guidelines
  • Self-review of code completed
  • Documentation updated (if applicable)
  • No sensitive information (API keys, credentials) exposed

Add argparse defaults for V4 export filenames and document the data/raw download workflow.
Add sync_package_indexes.py and document the step after build_faiss_indexes.py.
Expose --device auto|cpu|cuda on build_faiss_indexes so GPU nodes can
embed faster; document CUDA usage in data/raw README.
Add risk_corpus metadata, mit-risk-index page, and update docs/API copy
for 1,538 risks while noting JOSS v0.2.2 remains on the V3 snapshot.
Ship 1,538 risk and 5,993 RMF vectors in package and data/indexes
artifacts produced from the December 2025 MIT export.
Route /v1 to the backend on the compute host so SSH-forwarding only
port 5173 works; surface fetch errors in the analyze banner.
Bump to 0.3.0, add regression tests for corpus metadata and sync layout,
and document JOSS vs Zenodo citation practice in README and API docs.
Replace global FAISS RMF search (which returned duplicate template GOVERN
lines) with per-risk lookup from packaged rmf_meta.json.
Wire POST /v1/batch for text and risk modes; JSON/CSV downloads; surface
linked NIST AI RMF functions per risk; expose joined_table on RiskResult.
Dedupe risk cards by id/category; corpus badge on Risk tab; batch CSV
upload/progress/combined export; four RMF functions by default; clarify
template RMF provenance in docs and UI tooltips.
Keep .env.vector, .env.local, and local/ off the repo while allowing
in-cluster OpenAI-compatible proxy testing without accidental commits.
Send explicit workflow hints for text bias, close stale WebSockets, and
surface stream errors. Show an in-progress panel until completion and
render bias_result errors/warnings instead of an empty insights card.
Allow a small checked-in sample so batch risk runs can be tried without
exporting local outputs that stay gitignored.
@aravind-3105 aravind-3105 self-assigned this Nov 13, 2026
Add _typos.toml for EHR in examples, fix ruff line length and docstrings
in scripts, skip optional data/indexes sync check on CI, align risk graph
tests with default four RMF rows per risk, and normalize paper EOF.

@shainarazavi shainarazavi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen it thoroughly and tested , it looks good to me to merge

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants