Expand description
Large Language Model (LLM) Specific Debugging
This module provides specialized debugging capabilities for large language models, focusing on safety, alignment, factuality, toxicity detection, and performance characteristics specific to modern LLMs.
§Honesty notes on what these analyzers actually do
SafetyAnalyzer is a rule-based keyword heuristic over the literal
response text (see SafetyAnalyzer::find_harmful_keywords) – not a
trained safety classifier. Its safety_score and confidence are real
functions of measurable properties of the match (which keyword categories
fired, and how many), never flat literals.
FactualityChecker does no fact-checking: nothing in this crate
queries a knowledge base, so
FactualityAnalysisResult::factuality_score is always None. What it
does report are deterministic properties of the text under names that say
so – claim_like_sentences, uncertainty_indicator_hits and their ratio
FactualityAnalysisResult::uncertainty_density.
AlignmentMonitor, BiasDetector, HallucinationDetector and
ConversationAnalyzer have no per-response scorers at all. The
fixed-value scoring functions they used to carry were deleted rather than
kept behind a NOTE:, and the scores they used to fabricate are now
Option fields that stay None
(AlignmentAnalysisResult::alignment_score,
ConversationAnalysisResult::turn_quality, and so on). Scoring any of
them for real needs a policy/preference model, which this crate does not
ship.
Consequently the aggregate views are Options too:
AlignmentMetrics::overall_alignment_score and
FactualityMetrics::overall_factuality_score are None rather than the
0.85/0.8 they used to be seeded with, and
LLMHealthReport::overall_health_score averages only the terms that
exist. Every analyzer’s HealthTracker-backed get_health_summary
reports status/trend as a real, live function of whatever score that
analyzer actually produced (None / "Unknown (insufficient history)"
when it produced none) – never the old hardcoded HealthStatus::Good /
"Stable".
Structs§
- Alignment
Analysis Result - Alignment
Metrics - Metrics for alignment monitoring
- Alignment
Monitor - Alignment monitor for ensuring LLM outputs align with intended behavior
- BatchLLM
Analysis Report - Batch
Metrics - Aggregate view of one
LLMDebugger::analyze_batchrun. - Bias
Analysis Result - Bias
Detector - Bias detector for identifying various forms of bias in LLM outputs
- Bias
Metrics - Metrics for bias detection
- Consistency
Checker - Consistency checker for internal consistency in responses
- Context
Tracker - Context tracking for conversation continuity
- Conversation
Analysis Result - Conversation
Analyzer - Conversation analyzer for multi-turn dialog analysis
- Conversation
Turn - Single turn in a conversation
- Critical
Issue - Dialog
Metrics - Metrics for dialog analysis
- Efficiency
Metrics - Metrics for computational efficiency
- Factuality
Analysis Result - Factuality
Checker - Factuality checker for verifying the accuracy of LLM outputs
- Factuality
Metrics - Metrics for tracking factual accuracy
- Generation
Metrics - Metrics for text generation performance
- Hallucination
Analysis Result - Hallucination
Detector - Hallucination detector for identifying false or fabricated information
- Hallucination
Metrics - Metrics for hallucination detection
- Health
Summary - Health
Tracker - Tracks a bounded window of real, per-call analysis scores so
get_health_summarycan derive a realHealthStatusand trend direction from actual history, instead of the old hardcodedHealthStatus::Good/trend: "Stable".to_string()that never changed no matter what was analyzed. - LLMAnalysis
Report - LLMDebug
Config - Configuration for LLM debugging
- LLMDebugger
- Main LLM debugging framework
- LLMHealth
Report - LLMPerformance
Profiler - Performance profiler specific to LLM characteristics
- Performance
Analysis Result - Quality
Metrics - Metrics for output quality
- Safety
Analysis Result - Safety
Analyzer - Safety analyzer for detecting harmful, toxic, or inappropriate content
- Safety
Metrics - Safety metrics for tracking harmful content
- Scalability
Metrics - Metrics for scalability analysis
Enums§
- Alignment
Objective - Types of alignment objectives for LLMs
- Alignment
Trend - Trend in alignment scores over time
- Bias
Category - Types of bias to detect in LLM outputs
- Harm
Category - Categories of potential harm in LLM outputs
- Health
Status - Issue
Category - Issue
Severity - Risk
Level - Safety
Trend - Trend in safety scores over time
Functions§
- llm_
debugger - Create a new LLM debugger with default configuration
- llm_
debugger_ with_ config - Create a new LLM debugger with custom configuration
- performance_
focused_ config - Create a performance-focused LLM debugger configuration
- safety_
focused_ config - Create a safety-focused LLM debugger configuration