Views
No views yet
1import vllm
2
3def apply_template(question: str):
4 return ("""<|startoftext|>A conversation between User and Assistant. The User asks a question, and the Assistant solves it. \
5The Assistant first thinks about the reasoning process in the mind and then provides the User with the answer. \
6The reasoning process is enclosed within <think> </think> and answer is enclosed within <answer> </answer> tags, respectively, \
7i.e., <think> reasoning process here </think> <answer> answer here </answer>. \
8Please reason step by step, and put your final answer within \\boxed{}.
9
10User:
11{query}
12
13Assistant:
14""".replace("{query}", question))
15
16model_name = "Nickyang/ConciseR-Zero-7B"
17
18sampling_params = vllm.SamplingParams(
19 n=32,
20 temperature=0.6,
21 top_p=1.0,
22 max_tokens=3072,
23)
24
25model = vllm.LLM(
26 model_name,
27 max_model_len=4096,
28 dtype="bfloat16",
29 enable_prefix_caching=True,
30)
31
32prompts = [
33 "How many positive whole-number divisors does 196 have?"
34]
35prompts = list(map(apply_template, prompts))
36outputs = model.generate(prompts, sampling_params)
37
38print(outputs)1@misc{song2025conciser,
2 title={Walk Before You Run! Concise LLM Reasoning via Reinforcement Learning},
3 author={Mingyang Song and Mao Zheng},
4 year={2025},
5 eprint={2505.21178},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2505.21178},
9}