lm_polygraph.stat_calculators.semantic_classes_claim_to_samples module

class lm_polygraph.stat_calculators.semantic_classes_claim_to_samples.SemanticClassesClaimToSamplesCalculator(nli_model: Deberta)[source]

Bases: StatCalculator

Computes the NLI relationship between each claim and the corresponding sample texts.

This calculator constructs NLI input pairs between each claim and each sample sentence, then uses a DeBERTa-based NLI model to predict entailment, contradiction, or neutral.

The results are organized as a 3-level nested list structure:

[n_samples][n_claims_in_sample][n_sample_texts]

where each innermost list contains NLI labels for all sample sentences in relation to a claim.

This serves as a dependency for estimators that assess claim strength or validity using context-based entailment signals.

Required dependencies:
  • “sample_texts”: List of sentences for each sample

  • “claims”: List of Claim objects for each sample

Provides:
  • “nli_to_sample_texts”: List[List[List[Dict[str, float]]]] of NLI labels

static meta_info() Tuple[List[str], List[str]][source]

Placeholder method to return the list of statistics and dependencies for the calculator.