Text Classification
Transformers
Safetensors
qwen3
reward-model
rlhf
dpo
alignment
wildchat
text-embeddings-inference
Instructions to use THU-KEG/WildReward-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use THU-KEG/WildReward-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="THU-KEG/WildReward-4B")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("THU-KEG/WildReward-4B") model = AutoModelForSequenceClassification.from_pretrained("THU-KEG/WildReward-4B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- Qwen/Qwen3-4B
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- reward-model
|
| 8 |
+
- rlhf
|
| 9 |
+
- dpo
|
| 10 |
+
- alignment
|
| 11 |
+
- wildchat
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# WildReward
|
| 15 |
+
|
| 16 |
+
WildReward is a reward model trained on in-the-wild human-LLM interactions from the WildChat dataset. Unlike conventional reward models that rely on expensive human-annotated preference pairs, WildReward extracts implicit reward signals from real-world user feedback through an automated pipeline.
|
| 17 |
+
|
| 18 |
+
## Model Details
|
| 19 |
+
|
| 20 |
+
WildReward is trained using **ordinal regression** (CORAL-like approach) on the **WildFB dataset**, which contains 186k high-quality instances filtered and refined from WildChat. Each instance is labeled with 5 levels of user satisfaction (Rejection, Error Correction, Neutral Ambiguity, Positive Engagement, Satisfaction).
|
| 21 |
+
|
| 22 |
+
**Key Features:**
|
| 23 |
+
- ✅ Trained solely on in-the-wild interactions without human-annotated preference pairs
|
| 24 |
+
- ✅ Superior calibration with strong confidence-accuracy correlation
|
| 25 |
+
- ✅ Cross-sample consistency for reliable quality assessment
|
| 26 |
+
- ✅ Comparable performance to conventional RMs on RewardBench, RM-Bench, PPE, and JudgeBench
|
| 27 |
+
|
| 28 |
+
## Training Data
|
| 29 |
+
|
| 30 |
+
**WildFB Dataset** (186k instances)
|
| 31 |
+
- **Source:** WildChat - large-scale human-LLM interactions
|
| 32 |
+
- **Labeling:** 5-point ordinal scale based on user satisfaction signals
|
| 33 |
+
- **Filtering:** Two-stage refinement including implicit feedback mining and refusal validation
|
| 34 |
+
- **License:** [Specify your dataset license]
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
|
| 38 |
+
### Reward Scoring
|
| 39 |
+
|
| 40 |
+
```python
|
| 41 |
+
import torch
|
| 42 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 43 |
+
|
| 44 |
+
model_name = "yourusername/WildReward-Llama3-8B"
|
| 45 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 46 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 47 |
+
|
| 48 |
+
def build_text(query, response, history_str=""):
|
| 49 |
+
"""Format input text for reward model scoring."""
|
| 50 |
+
text = f"""
|
| 51 |
+
# Task Description
|
| 52 |
+
You are an expert conversation evaluator. Your task is to judge the **User's Satisfaction** with the Assistant's response based on the conversation context.
|
| 53 |
+
Please rate the response on a scale of 1 to 5 integers.
|
| 54 |
+
|
| 55 |
+
# Scoring Criteria
|
| 56 |
+
[1] CLEARLY NEGATIVE / REJECTION
|
| 57 |
+
[2] CORRECTION / ERROR POINTER (Negative)
|
| 58 |
+
[3] NEUTRAL
|
| 59 |
+
[4] POSITIVE ENGAGEMENT
|
| 60 |
+
[5] CLEAR SATISFACTION
|
| 61 |
+
|
| 62 |
+
# Input Data
|
| 63 |
+
## Context (History)
|
| 64 |
+
{history_str}
|
| 65 |
+
|
| 66 |
+
## User Query
|
| 67 |
+
{query}
|
| 68 |
+
|
| 69 |
+
## Assistant Response
|
| 70 |
+
{response}
|
| 71 |
+
|
| 72 |
+
# Output
|
| 73 |
+
Based on the criteria above, please output ONLY the integer score (1, 2, 3, 4, or 5).
|
| 74 |
+
"""
|
| 75 |
+
return text.strip()
|
| 76 |
+
|
| 77 |
+
# Prepare query and response
|
| 78 |
+
query = "Explain quantum computing in simple terms."
|
| 79 |
+
response = "Quantum computing uses quantum bits or 'qubits' that can exist in multiple states simultaneously, unlike classical bits..."
|
| 80 |
+
|
| 81 |
+
# Build formatted text
|
| 82 |
+
text = build_text(query, response)
|
| 83 |
+
|
| 84 |
+
# Tokenize
|
| 85 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=4096).to(model.device)
|
| 86 |
+
|
| 87 |
+
# Get reward score
|
| 88 |
+
with torch.no_grad():
|
| 89 |
+
outputs = model(**inputs)
|
| 90 |
+
logits = outputs.logits
|
| 91 |
+
|
| 92 |
+
# CORAL / Ordinal Regression (output shape: 1, K-1)
|
| 93 |
+
probs = torch.sigmoid(logits)
|
| 94 |
+
reward = 1 + torch.sum(probs).item()
|
| 95 |
+
|
| 96 |
+
print(f"Reward score: {reward:.2f} (scale: 1-5)")
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
**Architecture:**
|
| 101 |
+
- Router on port 9000 with round-robin load balancing
|
| 102 |
+
- Multiple workers on dedicated GPUs (ports 8004-8007)
|
| 103 |
+
- FP16 inference with batch processing
|
| 104 |
+
|
| 105 |
+
## Performance
|
| 106 |
+
|
| 107 |
+
WildReward achieves competitive results on standard reward model benchmarks while demonstrating superior calibration properties. When applied to Online DPO, it significantly improves performance in mathematical reasoning, instruction following, and creative writing tasks.
|
| 108 |
+
|
| 109 |
+
## Citation
|
| 110 |
+
|
| 111 |
+
```bibtex
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
## License
|
| 115 |
+
|
| 116 |
+
Apache License 2.0
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
**Note:** This model card provides a brief overview. For detailed documentation on data collection, training, and deployment, please visit the [GitHub repository](https://github.com/yourusername/WildReward).
|