Min-Li commited on
Commit
263ea83
·
verified ·
1 Parent(s): 0bd680d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +52 -15
README.md CHANGED
@@ -25,21 +25,58 @@ library_name: transformers
25
 
26
  ## RewardBench Leaderboard (Jan 2025)
27
 
28
- Rank | Model | Base Model | Method | Overall Score | Chat | Chat Hard | Safety | Reasoning |
29
- |:------|:------|:-----------|:-------|:------|:-----|:----------|:-------|:----------|
30
- 1 | [**Decision-Tree-Reward-Gemma-2-27B**](https://huggingface.co/RLHFlow/Decision-Tree-Reward-Gemma-2-27B) | Gemma-2-27B | Decision Tree | **95.3** | 96.9 | **91.4** | 93.7 | **99.1** |
31
- 2 | INF-QRM-Llama3.1-70B | Llama-3.1-70B | Sequence Classifier | 95.1 | 96.6 | 91.0 | 93.6 | **99.1** |
32
- 3 | QRM-Gemma-2-27B | Gemma-2-27B | Sequence Classifier | 94.4 | 96.6 | 90.1 | 92.7 | 98.3 |
33
- 4 | Skywork-Reward-Gemma-2-27B-v0.2 | Gemma-2-27B | Sequence Classifier | 94.3 | 96.1 | 89.9 | 93.0 | 98.1 |
34
- 5 | [**Decision-Tree-Reward-Llama-3.1-8B**](https://huggingface.co/RLHFlow/Decision-Tree-Reward-Llama-3.1-8B) | Llama-3.1-8B | Decision Tree | 94.3 | 96.9 | 89.3 | 92.9 | 98.5 |
35
- 6 | Llama-3.1-Nemotron-70B-Reward | Llama-3.1-70B | Custom Classifier | 94.1 | 97.5 | 85.7 | **95.1** | 98.1 |
36
- 7 | Skywork-Reward-Gemma-2-27B | Gemma-2-27B | Sequence Classifier | 93.8 | 95.8 | **91.4** | 91.9 | 96.1 |
37
- 8 | TextEval-Llama3.1-70B | Llama-3.1-70B | Generative | 93.5 | 94.1 | 90.1 | 93.2 | 96.4 |
38
- 9 | MetaMetrics-RM-v1.0 | - | Custom Classifier | 93.4 | **98.3** | 86.4 | 90.8 | 98.2 |
39
- 10 | Skywork-Critic-Llama-3.1-70B | Llama-3.1-70B | Generative | 93.3 | 96.6 | 87.9 | 93.1 | 95.5 |
40
- 11 | QRM-Llama3.1-8B-v2 | Llama-3.1-8B | Sequence Classifier | 93.1 | 96.4 | 86.8 | 92.6 | 96.8 |
41
- 12 | Skywork-Reward-Llama-3.1-8B-v0.2 | Llama-3.1-8B | Sequence Classifier | 93.1 | 94.7 | 88.4 | 92.7 | 96.7 |
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  ## License
44
  **Note**: This model is finetuned from a Skywork model under the following license agreement:
45
 
@@ -47,5 +84,5 @@ The community usage of Skywork model requires [Skywork Community License](https:
47
 
48
 
49
  ## To-Do
50
- + [ ] Reward Model Usage code
51
  + [ ] Architecture diagram
 
25
 
26
  ## RewardBench Leaderboard (Jan 2025)
27
 
28
+ Rank | Model | Base Model | Method | Overall Score | Chat | Chat Hard | Safety | Reasoning |
29
+ |:------|:------|:-----------|:-------|:--------------|:---------|:----------|:---------|:----------|
30
+ 1 | [**Decision-Tree-Reward-Gemma-2-27B**](https://huggingface.co/RLHFlow/Decision-Tree-Reward-Gemma-2-27B) | Gemma-2-27B | Decision Tree | **95.4** | 96.9 | **91.4** | 93.9 | **99.2** |
31
+ 2 | INF-QRM-Llama3.1-70B | Llama-3.1-70B | Sequence Classifier | 95.1 | 96.6 | 91.0 | 93.6 | 99.1 |
32
+ 3 | [**Decision-Tree-Reward-Llama-3.1-8B**](https://huggingface.co/RLHFlow/Decision-Tree-Reward-Llama-3.1-8B) | Llama-3.1-8B | Decision Tree | 94.5 | 96.6 | 89.5 | 93.2 | 98.6 |
33
+ 4 | QRM-Gemma-2-27B | Gemma-2-27B | Sequence Classifier | 94.4 | 96.6 | 90.1 | 92.7 | 98.3 |
34
+ 5 | Skywork-Reward-Gemma-2-27B-v0.2 | Gemma-2-27B | Sequence Classifier | 94.3 | 96.1 | 89.9 | 93.0 | 98.1 |
35
+ 6 | Llama-3.1-Nemotron-70B-Reward | Llama-3.1-70B | Custom Classifier | 94.1 | 97.5 | 85.7 | **95.1** | 98.1 |
36
+ 7 | Skywork-Reward-Gemma-2-27B | Gemma-2-27B | Sequence Classifier | 93.8 | 95.8 | **91.4** | 91.9 | 96.1 |
37
+ 8 | TextEval-Llama3.1-70B | Llama-3.1-70B | Generative | 93.5 | 94.1 | 90.1 | 93.2 | 96.4 |
38
+ 9 | MetaMetrics-RM-v1.0 | - | Custom Classifier | 93.4 | **98.3** | 86.4 | 90.8 | 98.2 |
39
+ 10 | Skywork-Critic-Llama-3.1-70B | Llama-3.1-70B | Generative | 93.3 | 96.6 | 87.9 | 93.1 | 95.5 |
40
+ 11 | QRM-Llama3.1-8B-v2 | Llama-3.1-8B | Sequence Classifier | 93.1 | 96.4 | 86.8 | 92.6 | 96.8 |
41
+ 12 | Skywork-Reward-Llama-3.1-8B-v0.2 | Llama-3.1-8B | Sequence Classifier | 93.1 | 94.7 | 88.4 | 92.7 | 96.7 |
42
 
43
+ ## Usage Code
44
+ Before using the model, ensure you have the following dependencies installed:
45
+ - `transformers==4.45.2`
46
+ - `torch>=2.5.0`
47
+ - `flash-attn>=2.6.3`
48
+
49
+ Note: This code requires a GPU with NVIDIA Ampere architecture or newer.
50
+ ```python
51
+ from transformers import AutoModelForSequenceClassification
52
+ import torch
53
+ from transformers import AutoTokenizer
54
+ model_name = "Decision-Tree-Reward-Gemma-2-27B" # Another choice is "Decision-Tree-Reward-Llama-3.1-8B"
55
+ repo_id = f"RLHFlow/{model_name}"
56
+ device = "cuda"
57
+ # Initialize the model and tokenizer
58
+ model = AutoModelForSequenceClassification.from_pretrained(repo_id, trust_remote_code=True, torch_dtype=torch.bfloat16, attn_implementation="flash_attention_2", device_map=device)
59
+ tokenizer = AutoTokenizer.from_pretrained(repo_id, use_fast=True)
60
+ # Load the decision tree
61
+ model.load_decision_tree(repo_id, filename="decision_tree.pkl")
62
+
63
+ # Prompt and response pairs
64
+ prompt = "Jane has 12 apples. She gives 4 apples to her friend Mark, then buys 1 more apple, and finally splits all her apples equally among herself and her 2 siblings. How many apples does each person get?"
65
+ response1 = "1. Jane starts with 12 apples and gives 4 to Mark. 12 - 4 = 8. Jane now has 8 apples.\n2. Jane buys 1 more apple. 8 + 1 = 9. Jane now has 9 apples.\n3. Jane splits the 9 apples equally among herself and her 2 siblings (3 people in total). 9 ÷ 3 = 3 apples each. Each person gets 3 apples."
66
+ response2 = "1. Jane starts with 12 apples and gives 4 to Mark. 12 - 4 = 8. Jane now has 8 apples.\n2. Jane buys 1 more apple. 8 + 1 = 9. Jane now has 9 apples.\n3. Jane splits the 9 apples equally among her 2 siblings (2 people in total). 9 ÷ 2 = 4.5 apples each. Each person gets 4 apples."
67
+
68
+ # Compare the two responses
69
+ output = model.compare(prompt, response1, response2, tokenizer, device)
70
+ print("Response 1 rewards")
71
+ print(dict(zip(output["attributes"], output["rewards"][0])))
72
+ # {'helpfulness': 3.7171721, 'correctness': 3.792478, 'coherence': 3.6601954, 'complexity': 0.8211964, 'verbosity': 1.8119512}
73
+ print("Response 2 rewards")
74
+ print(dict(zip(output["attributes"], output["rewards"][1])))
75
+ # {'helpfulness': -0.261065, 'correctness': -0.2378807, 'coherence': 2.4387608, 'complexity': 0.72620213, 'verbosity': 1.7181122}
76
+ print("Model preference")
77
+ print(output["preference"])
78
+ # 0
79
+ ```
80
  ## License
81
  **Note**: This model is finetuned from a Skywork model under the following license agreement:
82
 
 
84
 
85
 
86
  ## To-Do
87
+ + [x] Reward Model Usage code
88
  + [ ] Architecture diagram