govtech/rai-bench
Responsible AI Bench
Independent evaluation dashboard for large language models and safety guardrails on localised content safety, RAG knowledge robustness, and demographic fairness, benchmarked for Singapore deployment contexts.
Built by the AI Testing & Evaluation team at GovTech Singapore.
Benchmarks
Tech Stack
- Next.js 16 (App Router)
- React 19, TypeScript
- Inline styles + CSS variables (no CSS modules)
- Static data from CSV files in
public/
Getting Started
npm install
npm run devOpen http://localhost:3000.
Project Structure
src/
app/
page.tsx # Server component, loads data
globals.css # Design tokens + component styles
layout.tsx # Root layout with font config
components/
Nav.tsx # Fixed nav bar with scroll-triggered title
Hero.tsx # Banner with title + stats
BenchmarkExplainer.tsx # Mode toggle + criteria cards
EvaluationShell.tsx # Tab orchestration (models/guardrails)
LeaderboardTable.tsx # Models leaderboard with expandable rows
GuardrailsTable.tsx # Guardrails leaderboard
AboutSection.tsx # Methodology panels + taxonomy mappings
InsightsSection.tsx # Data visualisations
ScoreDistribution.tsx # Dot plot (models)
GuardrailDistribution.tsx # Dot plot (guardrails)
GuardrailBarChart.tsx # Bar chart (guardrails)
lib/
parseData.ts # Model CSV parsing + stats
parseGuardrails.ts # Guardrail CSV parsing + thresholds
types.ts # Shared TypeScript interfaces
utils.ts # Formatting + colour helpers
public/
data.csv # Model evaluation results
guardrails_data.csv # Guardrail evaluation resultsData
Evaluation results live in public/*.csv. To update scores, replace the CSV files and redeploy. The dashboard computes tercile thresholds at build time from the data.
Deployment
RAI Bench is deployed as a static Hugging Face Space. Hugging Face builds the Next.js application automatically whenever changes are pushed to main.
The Space configuration is declared in this README:
app_build_command: npm run buildruns the production build.app_file: out/index.htmlserves the generated static site.next.config.tsusesoutput: "export"to write the site toout/.
Generated files in out/ are not committed.
Before publishing, verify the production build locally:
npm ci
npm run buildThen commit and push the source changes:
git add README.md next.config.ts package.json package-lock.json src public
git commit -m "chore: update RAI Bench"
git push origin mainHugging Face will run the build and deploy the resulting static site automatically.
To update benchmark results, replace the relevant CSV files in public/, verify with npm run build, and push the source changes.
