Skip to content

Commit 631162d

Browse files
committed
Minor Modification
1 parent f8a7a2b commit 631162d

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/rank_llm/rerank/listwise/rankk_reranker.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from typing import Optional
22

33
from rank_llm.data import Result
4-
from rank_llm.rerank import PromptMode
54
from rank_llm.rerank.listwise import RankListwiseOSLLM
65

76

@@ -10,7 +9,6 @@ def __init__(
109
self,
1110
model: str = "hltcoe/Rank-K-32B",
1211
context_size: int = 4096,
13-
prompt_mode: PromptMode = PromptMode.RANK_GPT,
1412
prompt_template_path: Optional[
1513
str
1614
] = "src/rank_llm/rerank/prompt_templates/rank_k_template.yaml",
@@ -24,14 +22,13 @@ def __init__(
2422
super().__init__(
2523
model=model,
2624
context_size=context_size,
27-
prompt_mode=prompt_mode,
2825
prompt_template_path=prompt_template_path,
2926
num_few_shot_examples=num_few_shot_examples,
3027
device=device,
3128
num_gpus=num_gpus,
3229
variable_passages=variable_passages,
3330
is_thinking=True,
34-
reasoning_token_budget=10000,
31+
reasoning_token_budget=8000,
3532
window_size=window_size,
3633
use_alpha=use_alpha,
3734
)

src/rank_llm/rerank/prompt_templates/rank_k_template.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
method: "singleturn_listwise"
2-
prefix: |-
2+
prefix: |+
33
Determine a ranking of the passages based on how relevant they are to the query.
44
If the query is a question, how relevant a passage is depends on how well it answers the question.
55
If not, try analyze the intent of the query and assess how well each passage satisfy the intent.
@@ -13,5 +13,7 @@ prefix: |-
1313
Output only the ordering without any other text.
1414
1515
Query: {query}
16-
body: "\n\n[{rank}] {candidate}"
17-
suffix: ""
16+
17+
body: "[{rank}] {candidate}\n\n"
18+
output_validation_regex: r"^\[\d+\]( (>|=) \[\d+\])*$"
19+
output_extraction_regex: r"\[(\d+)\]"

src/rank_llm/rerank/reranker.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ def create_model_coordinator(
474474
print(f"Loading {model_path} ...")
475475
keys_and_defaults = [
476476
("context_size", 4096),
477-
("prompt_mode", PromptMode.RANK_GPT),
478477
(
479478
"prompt_template_path",
480479
"src/rank_llm/rerank/prompt_templates/rank_k_template.yaml",
@@ -490,7 +489,6 @@ def create_model_coordinator(
490489
]
491490
[
492491
context_size,
493-
prompt_mode,
494492
prompt_template_path,
495493
num_few_shot_examples,
496494
device,
@@ -505,7 +503,6 @@ def create_model_coordinator(
505503
model_coordinator = RankKReranker(
506504
model=(model_path),
507505
context_size=context_size,
508-
prompt_mode=prompt_mode,
509506
prompt_template_path=prompt_template_path,
510507
num_few_shot_examples=num_few_shot_examples,
511508
device=device,

0 commit comments

Comments
 (0)