mod stability#

module stability#

Stability analysis for prompt blocks across multiple observations.

Functions

fn analyze_stability(observations: &[PromptIR], thresholds: &StabilityThresholds) -> StabilityAnalysisResult#

Analyze prompt-block stability across multiple observations.

The analysis computes one stability score per span, ordered by the first sequence index at which that span appeared, and derives the length of the stable prefix at the start of the prompt.

Parameters

  • observations: Prompt observations to compare.

  • thresholds: Thresholds used for stability classification and confidence.

Returns

A StabilityAnalysisResult summarizing span-level stability.

fn find_stable_prefix_length(scores: &[BlockStabilityScore]) -> usize#

Count the number of leading scores classified as stable.

Parameters

  • scores: Span-level stability scores in prompt order.

Returns

The number of consecutive leading entries whose classification is StabilityClass::Stable.

Structs and Unions

struct StabilityAnalysisResult#

Result of analyzing prompt stability across a set of observations.

scores: Vec<BlockStabilityScore>#

Stability score for each distinct prompt span.

stable_prefix_length: usize#

Number of leading blocks that were classified as stable.

total_observations: u32#

Total number of observations included in the analysis.

struct StabilityThresholds#

Thresholds controlling prompt-block stability classification.

stable_threshold: f64#

Minimum effective score required for a block to be classified as stable.

semi_stable_threshold: f64#

Minimum effective score required for a block to be classified as semi-stable.

min_observations_for_full_confidence: u32#

Observation count required to reach full confidence.

Traits implemented

impl Default for StabilityThresholds#