Views
No views yet
🚨 We recommend using this model for competitive-style math and algorithm coding problems(such as Leetcode,Codeforces,etc). It works better to ask the question in English. We do not advise using it for other tasks, as this is an experimental release aimed at exploring the reasoning capabilities of small models.




1from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
2
3
4class VibeThinker:
5 def __init__(self, model_path):
6 self.model_path = model_path
7 self.model = AutoModelForCausalLM.from_pretrained(
8 self.model_path,
9 low_cpu_mem_usage=True,
10 torch_dtype="bfloat16",
11 device_map="auto"
12 )
13 self.tokenizer = AutoTokenizer.from_pretrained(self.model_path, trust_remote_code=True)
14
15 def infer_text(self, prompt):
16 messages = [
17 {"role": "user", "content": prompt}
18 ]
19 text = self.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
20 model_inputs = self.tokenizer([text], return_tensors="pt").to(self.model.device)
21
22 text = self.tokenizer.apply_chat_template(
23 messages,
24 tokenize=False,
25 add_generation_prompt=True
26 )
27 model_inputs = self.tokenizer([text], return_tensors="pt").to(self.model.device)
28
29 generation_config = dict(
30 max_new_tokens=40960,
31 do_sample=True,
32 temperature=0.6, # 0.6 or 1.0, you can set it according to your needs
33 top_p=0.95,
34 top_k=None # in vLLM or SGlang, please set top_k to -1, it means skip top_k for sampling
35 )
36 generated_ids = self.model.generate(
37 **model_inputs,
38 generation_config=GenerationConfig(**generation_config)
39 )
40 generated_ids = [
41 output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
42 ]
43
44 response = self.tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
45
46 return response
47
48
49if __name__ == '__main__':
50 model = VibeThinker('Your model path')
51 prompt = 'Your Prompt'
52 print(model.infer_text(prompt))@misc{xu2025tinymodelbiglogic,
title={Tiny Model, Big Logic: Diversity-Driven Optimization Elicits Large-Model Reasoning Ability in VibeThinker-1.5B},
author={Sen Xu and Yi Zhou and Wei Wang and Jixin Min and Zhibin Yin and Yingwei Dai and Shixi Liu and Lianyu Pang and Yirong Chen and Junlin Zhang},
year={2025},
eprint={2511.06221},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2511.06221},
}