Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load model and tokenizer
5model_name = "hazyresearch/Weaver_Distilled_All_Datasets_gte-Qwen2-1.5B-instruct"
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForSequenceClassification.from_pretrained(model_name)
8
9# Example usage - works across math, science, and academic domains
10instruction = "What is the derivative of f(x) = 3x² + 2x - 1?"
11response = "Using the power rule: f'(x) = 6x + 2. The derivative of 3x² is 6x, the derivative of 2x is 2, and the derivative of -1 is 0."
12
13# Tokenize input pair
14inputs = tokenizer(
15 instruction,
16 response,
17 truncation=True,
18 max_length=4096,
19 padding=True,
20 return_tensors="pt"
21)
22
23# Get correctness score
24with torch.no_grad():
25 outputs = model(**inputs)
26 score = torch.sigmoid(outputs.logits).item()
27
28print(f"Correctness score: {score:.3f}")
29print(f"Prediction: {'Correct' if score > 0.5 else 'Incorrect'}")1@misc{saadfalcon2025shrinkinggenerationverificationgapweak,
2 title={Shrinking the Generation-Verification Gap with Weak Verifiers},
3 author={Jon Saad-Falcon and E. Kelly Buchanan and Mayee F. Chen and Tzu-Heng Huang and Brendan McLaughlin and Tanvir Bhathal and Shang Zhu and Ben Athiwaratkun and Frederic Sala and Scott Linderman and Azalia Mirhoseini and Christopher Ré},
4 year={2025},
5 eprint={2506.18203},
6 archivePrefix={arXiv},
7 primaryClass={cs.CR},
8 url={https://arxiv.org/abs/2506.18203},
9}