-
LanguageValidator (Priority: HIGHEST)
- Must run FIRST
- Detects language mismatch
- Can patch answer if mismatch detected
- Dependencies: None (independent)
-
CitationRequired (Priority: CRITICAL)
- Must run before CitationRelevance
- Provides citations to answer
- Can patch answer (adds citations)
- Dependencies: None (but provides data for CitationRelevance)
-
ConfidenceValidator (Priority: CRITICAL)
- May depend on other validators' results
- Reads
previous_reasonsto detect source_contradiction - Dependencies:
- SourceConsensusValidator (if enabled) - detects contradictions
- EvidenceOverlap (if enabled) - checks overlap
- Note: Can run after parallel validators complete
-
FactualHallucinationValidator (Priority: CRITICAL)
- Detects factual errors
- Dependencies: None (reads answer and ctx_docs only)
-
ReligiousChoiceValidator (Priority: CRITICAL)
- Rejects religion choice in responses
- Dependencies: None (reads answer only)
-
CitationRelevance (Priority: MEDIUM)
- Checks citation quality
- Dependencies: CitationRequired (must run first to provide citations)
- Note: Currently marked as parallel, but depends on CitationRequired
- Recommendation: Keep sequential after CitationRequired
-
EvidenceOverlap (Priority: MEDIUM)
- Checks content matches context
- Dependencies: None (reads answer and ctx_docs only)
- Can run in parallel: ✅ YES
-
NumericUnitsBasic (Priority: LOW)
- Validates numeric/units claims
- Dependencies: None (reads answer only)
- Can run in parallel: ✅ YES
-
EgoNeutralityValidator (Priority: MEDIUM)
- Catches "Hallucination of Experience"
- Dependencies: None (reads answer and ctx_docs only)
- Can run in parallel: ✅ YES
-
SourceConsensusValidator (Priority: MEDIUM)
- Detects contradictions between sources
- Dependencies:
- EvidenceOverlap (should run after to check overlap first)
- ConfidenceValidator (uses results to express uncertainty)
- Note: Currently marked as both parallel and sequential (contradiction!)
- Recommendation: Run after EvidenceOverlap, before ConfidenceValidator (sequential)
-
IdentityCheckValidator (Priority: MEDIUM)
- Prevents anthropomorphism
- Dependencies: None (reads answer only)
- Can run in parallel: ✅ YES
-
PhilosophicalDepthValidator (Priority: LOW, Conditional)
- Validates philosophical depth
- Dependencies: None (reads answer only)
- Can run in parallel: ✅ YES
-
EthicsAdapter (Priority: CRITICAL)
- Ethical content filtering
- Dependencies: None (reads answer only)
- Can run in parallel: ✅ YES (but should run last for safety)
LanguageValidator → CitationRequired → [Parallel Group 2] → ConfidenceValidator
- CitationRelevance (after CitationRequired)
- EvidenceOverlap
- NumericUnitsBasic
- EgoNeutralityValidator
- IdentityCheckValidator
- PhilosophicalDepthValidator (if philosophical)
- EthicsAdapter (should run last, but can be parallel)
SourceConsensusValidator (after EvidenceOverlap) → ConfidenceValidator
FactualHallucinationValidator → ReligiousChoiceValidator
-
CitationRelevance marked as parallel but depends on CitationRequired
- Fix: Run sequentially after CitationRequired
-
SourceConsensusValidator marked as both parallel and sequential
- Fix: Run sequentially after EvidenceOverlap, before ConfidenceValidator
-
ConfidenceValidator depends on SourceConsensusValidator results
- Fix: Run sequentially after SourceConsensusValidator
-
EthicsAdapter should run last for safety
- Fix: Keep as last validator, but can still run in parallel with others
- Validators that read the same data (answer, ctx_docs) can share a cache
- Embeddings for ctx_docs can be computed once and shared
- Similarity scores can be cached
- Phase 1: Run sequential validators (LanguageValidator, CitationRequired)
- Phase 2: Run parallel validators in batches:
- Batch 1: CitationRelevance (depends on CitationRequired)
- Batch 2: EvidenceOverlap, NumericUnitsBasic, EgoNeutralityValidator, IdentityCheckValidator, PhilosophicalDepthValidator
- Batch 3: EthicsAdapter (last for safety)
- Phase 3: Run sequential validators (SourceConsensusValidator, ConfidenceValidator)
- Phase 4: Run critical validators (FactualHallucinationValidator, ReligiousChoiceValidator)
- Current: ~2-3s for full validation chain
- With NPR optimization: ~0.5-1s (2-3x speedup)
- Parallel validators: 6-8 validators can run concurrently
- Sequential validators: 4-5 validators must run in order
- ✅ Analyze dependencies (this document)
- ⏳ Optimize
_can_run_parallel()logic - ⏳ Implement batch-based parallel execution
- ⏳ Add shared KV cache for embeddings
- ⏳ Add performance metrics
- ⏳ Test and measure speedup