Skip to main content

Classes

CLASS BaseMBRDSampling

Abstract Minimum Bayes Risk Decoding (MBRD) Sampling Strategy.
Methods:

FUNC compare_strings

compare_strings(self, ref: str, pred: str) -> float
This method is the abstract method for MBRD similarity metric.

FUNC maybe_apply_weighted

maybe_apply_weighted(self, scr: np.ndarray)
Applies weights if self.weighted is True. Not Implemented.

FUNC sample

sample(self, action: Component[S], context: Context, backend: Backend, requirements: list[Requirement] | None) -> SamplingResult[S]
Samples using majority voting. Args:
  • action : The action object to be sampled.
  • context: The context to be passed to the sampling strategy.
  • backend: The backend used for generating samples.
  • requirements: List of requirements to test against (merged with global requirements).
  • validation_ctx: Optional context to use for validation. If None, validation_ctx = ctx.
  • format: output format for structured outputs; ignored for this sampling strategy.
  • model_options: model options to pass to the backend during generation / validation.
  • tool_calls: True if tool calls should be used during this sampling strategy.
  • show_progress: if true, a tqdm progress bar is used. Otherwise, messages will still be sent to flog.
Returns:
  • A result object indicating the success or failure of the sampling process.

CLASS MajorityVotingStrategyForMath

MajorityVoting Sampling Strategy for Math Expressions.
Methods:

FUNC compare_strings

compare_strings(self, ref: str, pred: str) -> float
Helper function to compare strings using the math extraction metrics.

CLASS MBRDRougeLStrategy

Sampling Strategy that uses RougeL to compute symbol-level distances for majority voting.
Methods:

FUNC compare_strings

compare_strings(self, ref: str, pred: str) -> float
Helper function to compare strings using the math extraction metrics.