Skip to content

Commit 135cf55

Browse files
[V1][Spec Decode][Ngram] 1.35x gain -> 1.95x gain on InstructCoder with prompt fix (vllm-project#18971)
1 parent 6cac54f commit 135cf55

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

benchmarks/benchmark_dataset.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,15 @@ def sample(
865865
for item in self.data:
866866
if len(sampled_requests) >= num_requests:
867867
break
868-
prompt = f"{item['instruction']}:\n{item['input']}"
868+
prompt = f"{item['input']}\n\n{item['instruction']} Just output \
869+
the code, do not include any explanation."
870+
871+
# apply template
872+
prompt = tokenizer.apply_chat_template(
873+
[{"role": "user", "content": prompt}],
874+
add_generation_prompt=True,
875+
tokenize=False,
876+
)
869877
prompt_len = len(tokenizer(prompt).input_ids)
870878
sampled_requests.append(
871879
SampleRequest(

vllm/benchmarks/datasets.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,19 @@ def sample(self,
880880
for item in self.data:
881881
if len(sampled_requests) >= num_requests:
882882
break
883-
prompt = f"{item['instruction']}:\n{item['input']}"
883+
prompt = f"{item['input']}\n\n{item['instruction']} Just output \
884+
the code, do not include any explanation."
885+
886+
# apply template
887+
prompt = tokenizer.apply_chat_template(
888+
[{
889+
"role": "user",
890+
"content": prompt
891+
}],
892+
add_generation_prompt=True,
893+
tokenize=False,
894+
)
895+
884896
prompt_len = len(tokenizer(prompt).input_ids)
885897
sampled_requests.append(
886898
SampleRequest(

0 commit comments

Comments
 (0)