Skip to content

fix(reranking): preserve retrieval order on equal scores - #898

Open
richarmurray6y8-creator wants to merge 1 commit into
Cinnamon:mainfrom
richarmurray6y8-creator:fix/889-rerank-tie-order
Open

richarmurray6y8-creator wants to merge 1 commit into
Cinnamon:mainfrom
richarmurray6y8-creator:fix/889-rerank-tie-order

Conversation

@richarmurray6y8-creator

Copy link
Copy Markdown

Description

Fixes #889. LLMTrulensScoring keeps each document's original retrieval index while preparing the scoring order. The result is sorted by score, with retrieval order breaking ties. For example, three passages returned in the order echo, charlie, alpha keep that order when each receives 0.5.

Type of change

  • Bug fix (non-breaking change).

Verification

The three new regressions failed against the original implementation and pass with the change. The four tests in tests/test_reranking.py pass on Python 3.11 with the locked dependencies. The tests cover sequential and concurrent ties and keep higher-scoring documents ahead of tied results. Black, isort, and Flake8 pass on both changed files.

Checklist

  • I have performed a self-review of my code.
  • I have added regression tests.
  • There is a reference to the original bug report.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] LLMTrulensScoring breaks equal-score ties by document text rather than retrieval order

1 participant