Skip to content

Added Reranker example #598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2025
Merged

Conversation

srv1n
Copy link
Contributor

@srv1n srv1n commented Dec 8, 2024

The parent llama.cpp repo recently added support for reranking.

This PR

  • Adds a rerank example
  • adds a new pooling type called rank( matches with llama.cpp implementation) in params
  • initialized_logits made public in llamabatch

Validated against all examples in the llama.cpp and BGE-reranker-v2-m3 and all rerank scores match.

Please review, make edits and feel free to commit. Thank you for the awesome repo!

Copy link
Contributor

@MarcusDunn MarcusDunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks for the PR.

my only question is, why did you make initialized_logits public?

@MarcusDunn
Copy link
Contributor

MarcusDunn commented Dec 8, 2024

also, is the submodule up to date enough to support this? yes it is.

@srv1n
Copy link
Contributor Author

srv1n commented Dec 9, 2024

I was trying to match it as closely with the original llama.cpp repo. Specifically the batch decode treats pooling type none and the other pooling types differently. .

I initially started off trying to modify the embedding example to match the original repo ( since reranking in llama.cpp is built into the examples/embedding.cpp ).

Its actually not being used in the reranking (since pooling is set to rank), but does it make sense to leave it public so we could use it with pooling type none if required?

@MarcusDunn
Copy link
Contributor

sorry for the late reply!

I would prefer we keep it private unless it is required to have a feature work.

@srv1n srv1n force-pushed the add-reranker-example branch from c72a971 to d789cac Compare February 6, 2025 12:45
@srv1n
Copy link
Contributor Author

srv1n commented Feb 6, 2025

My bad finally got around to it. Updated now. initialized_logits is not public anymore.

@MarcusDunn MarcusDunn merged commit 73a346c into utilityai:main Feb 6, 2025
2 of 5 checks passed
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.

2 participants