CoolFace
Apppublic

govtech/rai-bench

sourceHugging Faceupdated 1mo agoView on Hugging Face
6likes
App README

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

#BenchmarkMetricDirection
01Localised Undesired Content (RabakBench)Refusal RateHigher is better
02RAG Out-of-Knowledge-Base RobustnessAbstention RateHigher is better
03Demographic FairnessDisparity ScoreLower is better

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

bash
npm install
npm run dev

Open 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 results

Data

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 build runs the production build.
  • app_file: out/index.html serves the generated static site.
  • next.config.ts uses output: "export" to write the site to out/.

Generated files in out/ are not committed.

Before publishing, verify the production build locally:

bash
npm ci
npm run build

Then commit and push the source changes:

bash
git add README.md next.config.ts package.json package-lock.json src public
git commit -m "chore: update RAI Bench"
git push origin main

Hugging 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.