-
Notifications
You must be signed in to change notification settings - Fork 285
[llm_bench] Add reranking pipeline #2728
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds reranking pipeline functionality to the llm_bench tool, enabling benchmarking of text reranking models. The implementation supports both PyTorch and OpenVINO frameworks with Optimum Intel and GenAI backends.
- Introduces new
TextRerankerOptimum
andTextRerankerGenAI
pipeline classes for text reranking - Adds configuration options for reranking parameters (max_length, top_n, input texts)
- Integrates reranking functionality into the existing benchmark infrastructure
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
tools/llm_bench/task/text_reranker.py | Core implementation of text reranking pipelines and benchmark runner |
tools/llm_bench/task/pipeline_utils.py | Common pipeline base class with timing decorators |
tools/llm_bench/llm_bench_utils/pt_utils.py | PyTorch model creation utilities for reranking |
tools/llm_bench/llm_bench_utils/ov_utils.py | OpenVINO model creation utilities for reranking |
tools/llm_bench/llm_bench_utils/model_utils.py | Model configuration and argument processing updates |
tools/llm_bench/llm_bench_utils/metrics_print.py | Metrics printing enhancements for reranking |
tools/llm_bench/llm_bench_utils/hook_forward.py | Renamed hook class from EmbedForwardHook to RAGForwardHook |
tools/llm_bench/llm_bench_utils/hook_common.py | Updated hook creation for RAG/reranking use cases |
tools/llm_bench/llm_bench_utils/config_class.py | Configuration mappings for reranking model classes |
tools/llm_bench/benchmark.py | Main benchmark script integration with new reranking arguments |
tests/python_tests/samples/test_tools_llm_benchmark.py | Test cases for reranking functionality |
Comments suppressed due to low confidence (1)
tools/llm_bench/task/text_reranker.py:1
- Missing import statement for
json
module. Thejson.loads()
function is used on line 388 butjson
is not imported.
# -*- coding: utf-8 -*-
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
2efebe7
to
f08e2e7
Compare
e54086a
to
f9a9ddd
Compare
Data from example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
To be honest I don't have an answer, it's just this way it is historically, it's possible to align it, but this part of the code is used in many parts, so I would do it in a separate pr. |
How many prompts were processed during generation time of 31.2880s ? |
One query and two texts. Total is in |
77d26d4
to
175ed77
Compare
usage example:
python ../tools/llm_bench/benchmark.py -m ./models/ms-marco-MiniLM-L6-v2-text-class/ -n 1 --rerank --texts "side profile centered painted portrait, Gandhi rolling a blunt, Gloomhaven, matte painting concept art, art nouveau, 8K HD Resolution, beautifully background" --reranking_max_length 512 --reranking_top_n 3 --rerank
example output: