ax-diagnostic / app.py
seawolf2357's picture
init: AX Diagnostic Leaderboard MVP — Chitos-pattern shell, 4-step menu (Visualize/Diagnose/Report/Remediate), 7 axes, seeded leaderboard (metacog trap_rate + serving live values)
4a0c678
Raw
History Blame Contribute Delete
4 kB
# -*- coding: utf-8 -*-
"""AX Diagnostic Leaderboard — FastAPI shell (clone of Chitos serving pattern).
Menu: Visualize -> Diagnose -> Report -> Remediate. 7 axes -> AX Index."""
from pathlib import Path
from fastapi import FastAPI
from fastapi.responses import HTMLResponse, JSONResponse
app = FastAPI(title="AX Diagnostic Leaderboard")
# ── 7 평가 축 정의 (지표는 컬럼) ──────────────────────────────────────────────
AXES = [
{"code": "C1", "name_ko": "신뢰성·메타인지", "name_en": "Reliability & Metacognition",
"metrics": ["trap_rate↓", "doubt_auroc↑", "probe_gain↑"], "std": "TrustLLM · Vectara HHEM"},
{"code": "C2", "name_ko": "지능·역량", "name_en": "Intelligence",
"metrics": ["sci↑", "ko↑", "mmlu_pro↑", "math↑", "code↑"], "std": "HELM accuracy · OpenLLM"},
{"code": "C3", "name_ko": "구조 건강 (XRAY)", "name_en": "Structural Health (XRAY)",
"metrics": ["health_score↑", "grade", "expert_balance↑"], "std": "VIDRAFT proprietary (patent)"},
{"code": "C4", "name_ko": "서빙 성능", "name_en": "Serving Speed",
"metrics": ["ttft_p99↓", "tpot_p99↓", "throughput↑"], "std": "MLPerf Inference v5.1"},
{"code": "C5", "name_ko": "규제 컴플라이언스", "name_en": "Regulatory Compliance",
"metrics": ["ai_act_pass↑", "transparency↑"], "std": "NIST AI RMF · EU AI Act · Korea AI Act"},
{"code": "C6", "name_ko": "견고성·안전", "name_en": "Robustness & Safety",
"metrics": ["adv_resist↑", "jailbreak_resist↑"], "std": "HELM robustness · TrustLLM safety"},
{"code": "C7", "name_ko": "공정성·프라이버시", "name_en": "Fairness & Privacy",
"metrics": ["bias↓", "toxicity↓", "pii_leak↓"], "std": "HELM fairness · TrustLLM privacy"},
]
# ── 시드 리더보드 (장기기억 실측 기반 · seed 표기) ─────────────────────────────
# trap_rate: ginigen-ai/Metacognition-Leaderboard 실측 (22모델)
# 서빙: VKAE/JGOS 실측. 그 외 축은 초기 seed(추정)로 명시.
LEADERBOARD = [
{"model": "JGOS-31B-Citizen", "ax_index": 86, "grade": "A",
"trap_rate": 0.005, "health_grade": "A", "decode_tps": 455, "seed": True},
{"model": "Darwin-31B-Opus", "ax_index": 85, "grade": "A",
"trap_rate": 0.01, "health_grade": "A", "decode_tps": 210, "seed": True},
{"model": "Qwen3.5-27B", "ax_index": 82, "grade": "A",
"trap_rate": 0.01, "health_grade": "B", "decode_tps": 240, "seed": True},
{"model": "Darwin-35B-A3B-Opus", "ax_index": 80, "grade": "B",
"trap_rate": 0.01, "health_grade": "B", "decode_tps": 601, "seed": True},
{"model": "Darwin-28B-Opus", "ax_index": 66, "grade": "C",
"trap_rate": 0.51, "health_grade": "C", "decode_tps": 190, "seed": True},
{"model": "VibeThinker-3B", "ax_index": 48, "grade": "D",
"trap_rate": 0.72, "health_grade": "D", "decode_tps": 320, "seed": True},
{"model": "North-Mini", "ax_index": 45, "grade": "D",
"trap_rate": 0.76, "health_grade": "D", "decode_tps": 280, "seed": True},
{"model": "Ornith-1.0-35B", "ax_index": 43, "grade": "D",
"trap_rate": 0.78, "health_grade": "D", "decode_tps": 160, "seed": True},
]
@app.get("/api/health")
async def health():
return {"ok": True, "version": "0.1.0", "axes": len(AXES), "models": len(LEADERBOARD)}
@app.get("/api/axes")
async def axes():
return JSONResponse(AXES)
@app.get("/api/leaderboard")
async def leaderboard():
rows = sorted(LEADERBOARD, key=lambda r: r["ax_index"], reverse=True)
return JSONResponse({"rows": rows, "note": "seed data — real values populate as diagnostics run"})
@app.get("/", response_class=HTMLResponse)
async def root():
html = (Path(__file__).parent / "index.html").read_text(encoding="utf-8")
return HTMLResponse(html, headers={"Cache-Control": "no-store"})