Skip to content

feat(ai-hub): real extraction-grounding metric on the evaluation surface#947

Open
seonghobae wants to merge 2 commits into
developfrom
feat/ai-grounding-eval
Open

feat(ai-hub): real extraction-grounding metric on the evaluation surface#947
seonghobae wants to merge 2 commits into
developfrom
feat/ai-grounding-eval

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Why

The AI Hub evaluation surface reported only configuration counts (prompt / provider / audit tallies) as 'quality' — _score() literally sums prompt_count*10 + …. It could not say whether the AI's extractions are grounded in evidence. Without measurement there is no defensible, improvable AI advantage — this is the measurement side of the evidence-based moat.

What

  • services/ai_grounding_eval.py: a pure, unit-tested compute_grounding_metrics() — grounding rate (objects citing ≥1 source segment), mean / low confidence, human-correction rate — plus a thin owner-scoped load_grounding_metrics() over the stored ProjectGraphObjectRecord + ProjectGraphCorrectionRecord.
  • api/ai_hub.py: appends a real '추출 근거 결속률' metric to the evaluation surface alongside the existing counts — additive, non-destructive. The frontend renders evaluation_metrics generically, so it surfaces with no UI change.

Verification (local)

  • 3 new pure-metric tests (typical / all-grounded / empty-safe).
  • test_ai_hub_api.py surface tests pass (empty extraction data → grounding 0, surface still builds); extended the mock result with .all()/.scalar_one().
  • bandit clean.

Follow-ups

Retrieval hit-rate + citation-validity metrics; a golden/eval-set runner once correction volume grows (ProjectGraphCorrectionRecord already exists). Independent of the mail read-state work (#946) — different files.

🤖 Generated with Claude Code

seonghobae and others added 2 commits July 6, 2026 23:39
The AI Hub evaluation surface reported only configuration counts (prompt /
provider / audit tallies) as 'quality' — it could not say whether the AI's
extractions are actually grounded in evidence. Without measurement there is no
defensible, improvable AI advantage.

- services/ai_grounding_eval.py: a pure, unit-tested compute_grounding_metrics()
  (grounding rate = objects citing >=1 source segment, mean/low confidence,
  human-correction rate) plus a thin owner-scoped load_grounding_metrics() over
  the stored project-graph extraction objects and corrections.
- api/ai_hub.py: appends a real '추출 근거 결속률' metric to the evaluation
  surface alongside the existing counts — additive, non-destructive. The
  frontend renders evaluation_metrics generically, so it surfaces with no UI change.

Verified: 3 new pure-metric tests, ai_hub surface tests pass (empty extraction
data -> grounding 0, surface still builds), bandit clean.

Follow-ups: retrieval hit-rate + citation-validity metrics; a golden/eval-set
runner once correction volume grows (ProjectGraphCorrectionRecord already exists).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RkKdtHRLG4wSLh6PVsp8J
Self-review before human review: the rest of the AI Hub surface is
workspace-scoped, but load_grounding_metrics filtered only user_id +
organization_id, so a user's other workspaces would bleed into one workspace's
grounding number. Add workspace_id to the owner predicates and thread
auth_context.workspace_id through.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RkKdtHRLG4wSLh6PVsp8J
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.

1 participant