feat(ai-hub): real extraction-grounding metric on the evaluation surface#947
Open
seonghobae wants to merge 2 commits into
Open
feat(ai-hub): real extraction-grounding metric on the evaluation surface#947seonghobae wants to merge 2 commits into
seonghobae wants to merge 2 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The AI Hub evaluation surface reported only configuration counts (prompt / provider / audit tallies) as 'quality' —
_score()literally sumsprompt_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-testedcompute_grounding_metrics()— grounding rate (objects citing ≥1 source segment), mean / low confidence, human-correction rate — plus a thin owner-scopedload_grounding_metrics()over the storedProjectGraphObjectRecord+ProjectGraphCorrectionRecord.api/ai_hub.py: appends a real '추출 근거 결속률' metric to the evaluation surface alongside the existing counts — additive, non-destructive. The frontend rendersevaluation_metricsgenerically, so it surfaces with no UI change.Verification (local)
test_ai_hub_api.pysurface tests pass (empty extraction data → grounding 0, surface still builds); extended the mock result with.all()/.scalar_one().banditclean.Follow-ups
Retrieval hit-rate + citation-validity metrics; a golden/eval-set runner once correction volume grows (
ProjectGraphCorrectionRecordalready exists). Independent of the mail read-state work (#946) — different files.🤖 Generated with Claude Code