Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Heuristic:24kchengYe MemoMind Recency Temporal Alpha Tuning

From Leeroopedia
Knowledge Sources
Domains Retrieval, Reranking
Last Updated 2026-10-28 14:45 GMT

Overview

Recency and temporal proximity boosts are applied as multiplicative adjustments with alpha=0.2 (±10%), keeping secondary signals proportional to the cross-encoder base score.

Description

After cross-encoder reranking, recency and temporal proximity are applied as multiplicative boosts to the normalized cross-encoder score. Each boost uses `alpha=0.2`, meaning the maximum adjustment is ±10% (formula: `1 + alpha * (signal - 0.5)`). Recency decays linearly over 365 days from [1.0, 0.1] (neutral 0.5 if no date). Temporal proximity is set by the temporal retrieval signal (neutral 0.5 for non-temporal queries). The combined effect: max boost ≈ +21%, min ≈ −19%. This ensures secondary signals never override the primary relevance signal — they only nudge it.

Usage

Use this heuristic when tuning search ranking quality — if recent results are not surfacing enough, increase `recency_alpha`; if temporal queries are over-prioritizing time-matched but irrelevant results, decrease `temporal_alpha`. Default alpha=0.2 is a conservative starting point.

The Insight (Rule of Thumb)

  • Action: Set `recency_alpha=0.2` and `temporal_alpha=0.2` for combined scoring after cross-encoder reranking.
  • Value: `alpha=0.2` → max ±10% relative adjustment per signal. Combined: +21% to −19%.
  • Trade-off: Higher alpha = stronger recency/temporal bias but risks surfacing less relevant recent results. Lower alpha = purer relevance ranking but ignores time context.
  • Compatibility: Recency is neutral (0.5) when no `occurred_start` date exists. Temporal is neutral (0.5) for non-temporal queries. Both collapse gracefully — no boost is applied when signals are absent.

Reasoning

Multiplicative boosts (rather than additive) ensure that secondary signals scale proportionally with the base relevance score. A 10% boost on a high-relevance result (0.9) shifts it by 0.09, while the same boost on a low-relevance result (0.3) shifts it by only 0.03. This prevents weak-but-recent results from jumping past strong-but-old results. The ±10% range is deliberately small — it breaks ties and nudges ordering but does not override the cross-encoder's judgment. The linear 365-day recency decay means results older than 1 year are clamped to 0.1 (10% of max), providing a smooth temporal gradient.

Code Evidence

Alpha constants from `reranking.py:14-15`:

# Each signal contributes at most ±(alpha/2) relative adjustment to the base CE score,
# so the max combined boost is (1 + alpha/2)^2 ≈ +21% and min is (1 - alpha/2)^2 ≈ -19%.
_RECENCY_ALPHA: float = 0.2
_TEMPORAL_ALPHA: float = 0.2

Combined scoring formula from `reranking.py:49-69`:

for sr in scored_results:
    # Recency: linear decay over 365 days → [0.1, 1.0]; neutral 0.5 if no date.
    sr.recency = 0.5
    if sr.retrieval.occurred_start:
        days_ago = (now - occurred).total_seconds() / 86400
        sr.recency = max(0.1, min(1.0, 1.0 - (days_ago / 365)))
    # Temporal proximity: meaningful only for temporal queries; neutral otherwise.
    sr.temporal = sr.retrieval.temporal_proximity if sr.retrieval.temporal_proximity is not None else 0.5
    recency_boost = 1.0 + recency_alpha * (sr.recency - 0.5)
    temporal_boost = 1.0 + temporal_alpha * (sr.temporal - 0.5)
    sr.combined_score = sr.cross_encoder_score_normalized * recency_boost * temporal_boost

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment