lpgcast.bench.compare¶
Paired comparison of two benchmark reports, episode by episode.
Episodes pair on case name and source id; only paired episodes enter the pooled figures. Runs on different corpus versions pair only the cases whose content digest is the same in both; a report written before cases carried digests pairs by case name only when the caller says the cases are unchanged. Each headline rate is read off the pooled counts of either run, and its difference gets a paired bootstrap interval: episodes are resampled with their pair, so the interval reflects how much the difference depends on which episodes the corpus happens to hold. The resampling is seeded, so a comparison of the same two files is byte-identical.
Attributes¶
DIGITS = {'tokens_per_episode': 0}
module-attribute
¶
HEADLINE = ('conformance', 'conformance_final', 'type_hallucination', 'relation_hallucination', 'property_hallucination', 'ungrounded', 'unfaithful_value', 'entity_f1', 'edge_f1', 'property_f1', 'direction', 'span_accuracy', 'tokens_per_episode', 'requests_per_episode')
module-attribute
¶
RESAMPLES = 2000
module-attribute
¶
SEED = 0
module-attribute
¶
STATUSES = ('ok', 'partial', 'failed')
module-attribute
¶
TOP = 10
module-attribute
¶
Classes¶
CompareError
¶
CompareReport
¶
Bases: BaseModel
Run B read against run A.
Source code in lpgcast/bench/compare.py
Attributes¶
changed_cases = Field(description='Cases in both runs whose content differs; left out.')
class-attribute
instance-attribute
¶
corpus_digest
instance-attribute
¶
corpus_version
instance-attribute
¶
corpus_version_b
instance-attribute
¶
drops
instance-attribute
¶
losses = Field(description='Episodes whose score fell.')
class-attribute
instance-attribute
¶
only_a = Field(description='``case/source_id`` only in run A.')
class-attribute
instance-attribute
¶
only_b = Field(description='``case/source_id`` only in run B.')
class-attribute
instance-attribute
¶
paired
instance-attribute
¶
paired_by_name = Field(default=False, description="Corpora differ and cases were paired by name on the caller's word.")
class-attribute
instance-attribute
¶
rates
instance-attribute
¶
resamples
instance-attribute
¶
rises
instance-attribute
¶
row_a
instance-attribute
¶
row_b
instance-attribute
¶
split_a
instance-attribute
¶
split_b
instance-attribute
¶
ties
instance-attribute
¶
transitions = Field(description='Status in A → status in B → episodes.')
class-attribute
instance-attribute
¶
unscored = Field(description='Episodes with no score in either run.')
class-attribute
instance-attribute
¶
wins = Field(description='Episodes whose score rose.')
class-attribute
instance-attribute
¶
EpisodeDelta
¶
Bases: BaseModel
One paired episode.
Source code in lpgcast/bench/compare.py
RateDelta
¶
Bases: BaseModel
One rate in both runs and its paired difference.
Source code in lpgcast/bench/compare.py
Attributes¶
a
instance-attribute
¶
b
instance-attribute
¶
delta = Field(description='b − a.')
class-attribute
instance-attribute
¶
high = Field(description='97.5th percentile of the bootstrap delta.')
class-attribute
instance-attribute
¶
low = Field(description='2.5th percentile of the bootstrap delta.')
class-attribute
instance-attribute
¶
rate
instance-attribute
¶
Functions:¶
compare(a, b, *, row_a=None, row_b=None, resamples=RESAMPLES, pair_by_name=False)
¶
Read b against a, episode by episode.
Raises:
| Type | Description |
|---|---|
CompareError
|
the reports ran against different corpora with no case in common, a row is ambiguous or missing, or no episode pairs. |
Source code in lpgcast/bench/compare.py
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 | |
load_report(path)
¶
pick_row(report, label)
¶
The row named label; without one, the only row or the only model row.
Raises:
| Type | Description |
|---|---|
CompareError
|
no such row, or more than one candidate. |
Source code in lpgcast/bench/compare.py
to_markdown(report)
¶
The human-readable comparison.
Source code in lpgcast/bench/compare.py
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 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |