Views
No views yet

1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "INSAIT-Institute/OPC-R1-8B"
4
5# load the tokenizer and the model
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype="auto",
10 device_map="auto"
11)
12
13# prepare the model input
14
15problem = "Compute the number of real solutions of the equation $x^2 + 2x + 2 = 0$."
16solution = "The equation can be factored in as $x^2 + 2x + 2 = (x+1)^2 + 1$. Because $(x+1)^2 \\geq 0$, then $x^2 + 2x + 2 \\geq 1 > 0$. Therefore, there are \\boxed{0} real solutions."
17
18prompt = "<substitute the evaluation prompt template from the paper>"
19messages = [
20 {"role": "user", "content": prompt.format(problem=problem, solution=solution)}
21]
22text = tokenizer.apply_chat_template(
23 messages,
24 tokenize=False,
25 add_generation_prompt=True,
26 enable_thinking=True
27)
28model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
29
30# conduct text completion
31generated_ids = model.generate(
32 **model_inputs,
33 max_new_tokens=32768
34)
35output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
36
37content = tokenizer.decode(output_ids, skip_special_tokens=True).strip("\n")
38
39print("content:", content)| Judge | pass@1 | maj@5 | Cost (USD) |
|---|---|---|---|
| Human | 90.4 | - | N/A |
| Gemini 2.5 Pro | 85.4 | 88.1 | 135.47 |
| OPC-R1-8B | 83.8 | 88.1 | N/A |
| o4-mini | 83.8 | 85.3 | 29.57 |
| o3 | 83.1 | 84.3 | 93.3 |
| Qwen3 235B-A22B | 81.8 | 84.6 | 3.79 |
| DeepSeek R1 (05/28) | 80.9 | 82.6 | 27.35 |
| DeepSeek R1 Distill 8B | 70.7 | 71.3 | N/A |
| Qwen3-8B | 64.4 | 63.6 | N/A |
| Dataset | Download |
|---|---|
| OPC | 🤗 HuggingFace |
@article{openproofcorpus2025,
title={The Open Proof Corpus: A Large-Scale Human Study of LLM Proofs},
author={Jasper Dekoninck and Ivo Petrov and Kristian Minchev and Mislav Balunovic and Martin Vechev and Miroslav Marinov, Maria Drencheva and Lyuba Konova and Milen Milenov Shumanov and Kaloyan Tsvetkov and Nikolay Drenchev and Lazar D. Todorov and Kalina Nikolova and Nikolay Georgiev and Vanesa Kalinkova and Margulan Ismoldayev},
journal={arXiv},
year={2025},
}