pub fn recall_scale(
target_recall: Option<f32>,
base_ef: usize,
base_oversample: u8,
) -> Result<(usize, u8), RerankError>Expand description
Scale ef_search and oversample up to meet a recall target.
target_recall must be in (0.0, 1.0]. Returns (ef, oversample) adjusted
for the given target. When target_recall is None or already-default,
returns the base values unchanged.
Formula (heuristic, not a guarantee):
- For
r <= 0.80: identity —ef = base_ef,oversample = base_oversample. - For
r > 0.80: ramp scale from 1.0× at r=0.80 to 5.0× at r=1.00, linearly.scale = 1.0 + (r - 0.80) / 0.20 * 4.0, clamped to[1.0, 5.0]. efbecomesmax(base_ef, (base_ef as f32 * scale).ceil() as usize).oversamplebecomesmax(base_oversample, (base_oversample as f32 * scale.sqrt()).ceil() as u8)— oversample grows sub-linearly because rerank cost is linear in oversample, while ef has a more favourable cost curve.