Implement evidence-based confidence calibration engine with uncertainty-aware policies and APIs#81
Open
Copilot wants to merge 2 commits into
Open
Implement evidence-based confidence calibration engine with uncertainty-aware policies and APIs#81Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Implement evidence-based confidence calibration for RAG responses
Implement evidence-based confidence calibration engine with uncertainty-aware policies and APIs
Jun 4, 2026
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.
Summary
This PR upgrades confidence from score heuristics to an evidence-calibrated model that accounts for coverage, agreement, contradiction risk, source diversity, and rerank stability, then selects uncertainty-aware actions. It also exposes confidence scoring/calibration/explain APIs and surfaces calibrated traces in Dev Mode.
ConfidenceCalibrationEngine+ConfidenceSignalCollectorwith typed outputs:ConfidenceScore,ConfidenceBreakdown,ConfidenceTrace,ConfidenceFactor,CalibrationProfile.EvidenceCoverageEstimator(QueryFacetExtractor,MissingEvidenceDetector,FacetCoverageResult).EvidenceAgreementAnalyzer(ClaimExtractor,ClaimSupportMapper,ConsensusScore,EvidenceCluster).ContradictionDetector(ConflictPair,ConflictSeverity,ConflictResolutionHint).SourceDiversityAnalyzer+ provenance/independence scoring.RerankStabilityAnalyzer(RankingDelta,RankCorrelationScore,RetrievalStabilityReport).ConfidencePolicyEnginewithConfidenceThresholdsand action selection (answer_with_uncertainty,run_contradiction_check,refuse_due_to_insufficient_evidence, etc.).calibrateConfidencepath to preserve backward-compatible fields and append calibrated outputs.POST /confidence/score,/confidence/calibrate,/confidence/evaluate,/confidence/explain;GET /confidence/policies,/confidence/runs.Roadmap Scope
apps/api/src/retrieval-reliability.test.tsapps/api/src/server.test.tsnpm run build,npm testValidation
Documentation Checklist
docs/documentation-governance.mdREADME.mdis updated when roadmap status/scope changedapps/*,packages/*,experiments/*,infra/*)docs/*contract/runbook/phase document is updatedNo documentation files were changed in this PR because scope is implementation-focused in existing reliability/RAG modules and endpoint additions are self-describing via controller/type changes; docs can be updated in a follow-up phase-status pass.
Risk & Rollback
retrieval-reliability.ts,rag-service.ts, andapps/api/src/rag/confidence.controller.tsto restore previous confidence path; keep legacyconfidenceScore/confidenceLevel/evidenceSignals/factorscontract unchanged.