karenina.schemas.results.rubric_judgment¶
rubric_judgment
¶
RubricJudgmentResults class for detailed deep judgment rubric analysis.
This module provides excerpt-level explosion of deep judgment rubric evaluation results, enabling fine-grained analysis of extracted evidence and reasoning.
Classes¶
RubricJudgmentResults
¶
Bases: BaseModel
Detailed deep judgment rubric evaluation results with excerpt-level explosion.
This class provides a specialized view of deep judgment rubric evaluation results, exploding each trait's excerpts into separate rows for fine-grained analysis. Each row represents one (trait × excerpt) combination, with full metadata about the excerpt, reasoning, and evaluation process.
Explosion Strategy
- Traits WITH excerpts: One row per excerpt (N rows for N excerpts)
- Traits WITHOUT excerpts: Single row with excerpt fields set to None
Use Cases
- Analyzing individual excerpts and their confidence scores
- Examining excerpt-level hallucination risks
- Studying retry patterns and validation failures
- Deep-diving into reasoning process for specific traits
- Understanding model behavior during excerpt extraction
Comparison with RubricResults
- RubricResults: One row per trait (standard export, backward compatible)
- RubricJudgmentResults: Multiple rows per trait (excerpt explosion, detailed)
Attributes:
| Name | Type | Description |
|---|---|---|
results |
list[VerificationResult]
|
List of VerificationResult objects containing deep judgment data |
Source code in src/karenina/schemas/results/rubric_judgment.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
Functions¶
__init__
¶
__init__(
results: list[VerificationResult], **data: Any
) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results
¶ |
list[VerificationResult]
|
List of VerificationResult objects |
required |
**data
¶ |
Any
|
Additional pydantic model data |
{}
|
Source code in src/karenina/schemas/results/rubric_judgment.py
get_excerpt_count_summary
¶
Get summary of excerpt counts per trait across all results.
Returns:
| Name | Type | Description |
|---|---|---|
dict[str, dict[str, int]]
|
Dictionary mapping trait names to excerpt statistics |
|
Format |
dict[str, dict[str, int]]
|
{trait_name: {"total_excerpts": N, "avg_excerpts": M, "results_with_trait": K}} |
Example
summary = rubric_judgments.get_excerpt_count_summary() print(summary["clarity"]) {'total_excerpts': 35, 'avg_excerpts': 7.0, 'results_with_trait': 5}
Source code in src/karenina/schemas/results/rubric_judgment.py
get_results_with_deep_judgment
¶
get_results_with_deep_judgment() -> list[
VerificationResult
]
Get only results that have deep judgment rubric data.
Returns:
| Type | Description |
|---|---|
list[VerificationResult]
|
List of results where deep judgment rubric evaluation was performed |
Source code in src/karenina/schemas/results/rubric_judgment.py
get_retry_summary
¶
Get summary of excerpt extraction retries per trait.
Returns:
| Name | Type | Description |
|---|---|---|
dict[str, dict[str, Any]]
|
Dictionary mapping trait names to retry statistics |
|
Format |
dict[str, dict[str, Any]]
|
{trait_name: {"total_retries": N, "max_retries": M, "traits_with_retries": K}} |
Example
summary = rubric_judgments.get_retry_summary() print(summary["specificity"]) {'total_retries': 8, 'max_retries': 3, 'traits_with_retries': 4}
Source code in src/karenina/schemas/results/rubric_judgment.py
to_dataframe
¶
Convert deep judgment rubric results to pandas DataFrame with excerpt explosion.
Creates multiple rows per trait (one per excerpt) for comprehensive analysis. Traits without excerpts get a single row with excerpt fields set to None.
Column Categories
- Status: completed_without_errors, error
- Identification: question_id, template_id, question_text, keywords, replicate
- Model Config: answering_model, parsing_model, system_prompts
- Trait Identification: trait_name, trait_score, trait_type
- Trait Reasoning: trait_reasoning
- Trait Metadata:
- trait_model_calls: Number of LLM calls for this trait
- trait_excerpt_retries: Number of excerpt extraction retries
- trait_stages_completed: JSON list of completed stages
- trait_validation_failed: Whether validation failed
- trait_had_excerpts: Whether trait used excerpt extraction
- Excerpt Data (exploded, per-excerpt):
- excerpt_index: Index of this excerpt (0-based)
- excerpt_text: Verbatim text excerpt
- excerpt_confidence: Confidence score (if available)
- excerpt_similarity_score: Fuzzy match similarity score
- Excerpt Hallucination (if search enabled):
- excerpt_hallucination_risk: Risk level assessment
- excerpt_hallucination_justification: Reasoning for risk
- excerpt_search_results: JSON of search validation results
- Execution Metadata: execution_time, timestamp, run_name
Returns:
| Type | Description |
|---|---|
Any
|
pandas.DataFrame: Exploded DataFrame with one row per (trait × excerpt) |
Example
result_set = benchmark.run_verification_new(config)["question_id"]
rubric_judgments = result_set.get_rubric_judgments_results()
df = rubric_judgments.to_dataframe()
# Analyze per-excerpt confidence
df.groupby("trait_name")["excerpt_confidence"].mean()
# Examine traits with validation failures
df[df["trait_validation_failed"] == True][["trait_name", "trait_excerpt_retries"]]
# Study hallucination risks
df[df["excerpt_hallucination_risk"].notna()][["excerpt_text", "excerpt_hallucination_risk"]]
Source code in src/karenina/schemas/results/rubric_judgment.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |