Instructions to use openeurollm/prelude-reward-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openeurollm/prelude-reward-models with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("openeurollm/prelude-reward-models", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Prelude reward models
Two scalar reward models for answers in 38 European languages, trained for reinforcement learning of OpenEuroLLM Prelude 9B. Given a conversation and one answer to its last user turn, a model returns a single number; the better answer gets the higher one. Both were trained on the same preference data, openeurollm/prelude-reward-modeling, and are in separate branches of this repository:
| Branch | Base model |
|---|---|
gemma-4-31b |
google/gemma-4-31B-it |
qwen3.8-27b |
Qwen/Qwen3.8-27B |
main holds only this card. The Gemma model is slightly better on most measures below; the two agree closely
(their reward differences correlate at 0.98).
Evaluation
Validation is on 1,008 pairs held out from training: 200 English pairs and 17–50 for each other language, with the safety and instruction-following categories over-represented. Its labels are the judges' votes, as in training. For 935 of these pairs there is also a reference verdict from Claude Opus 5.5, which gave the same verdict in both presentation orders. The benchmarks are scored with their official rules; the training prompts were decontaminated against all three.
| Gemma 4 31B RM | Qwen3.8-27B RM | |
|---|---|---|
| Validation, 1,008 pairs, 38 languages | ||
| Accuracy against the judges' majority (even splits left out) | 92.6 | 91.3 |
| Agreement with Claude Opus 5.5 (935 pairs) | 91.7 | 91.7 |
| Log loss against the soft labels | 0.312 | 0.313 |
| Benchmarks | ||
| RewardBench 2 | 81.2 | 79.2 |
| RM-Bench, all (hard) | 86.3 (80.5) | 85.1 (78.7) |
| M-RewardBench, 11 European languages | 90.5 | 90.0 |
Validation per language tier, accuracy against the judges' majority (agreement with Opus per tier is in the next table):
| Tier | Languages | Pairs | Gemma 4 31B RM | Qwen3.8-27B RM |
|---|---|---|---|---|
| English | en | 200 | 87.2 | 83.1 |
| Large | de, es, fr, it, pt | 250 | 91.9 | 92.7 |
| Mid | bg, bs, ca, cs, da, el, fi, hr, hu, lt, nb, nl, pl, ro, sk, sv, tr, uk | 306 | 97.0 | 94.3 |
| Small | et, eu, ga, gl, is, ka, lv, ltg, mk, mt, nn, sl, sq, sr | 252 | 92.2 | 92.7 |
Agreement with Claude Opus 5.5 on the 935 validation pairs where Opus gave the same verdict in both orders: the reward models, the training labels and the LLM judges, overall and per tier.
| All | English | Large | Mid | Small | |
|---|---|---|---|---|---|
| Pairs | 935 | 183 | 235 | 283 | 234 |
| Reward models | |||||
| Gemma 4 31B RM | 91.7 | 86.9 | 92.8 | 96.1 | 88.9 |
| Qwen3.8-27B RM | 91.7 | 85.2 | 94.9 | 95.1 | 89.3 |
| Training labels | |||||
| The judges' pooled votes (in-sample) | 95.0 | 92.3 | 95.7 | 97.3 | 93.6 |
| Judges with reasoning | |||||
| Gemma 4 31B, thinking | 92.7 | 89.1 | 94.9 | 93.8 | 91.9 |
| Qwen3.8-27B, thinking (effort xhigh) | 92.5 | 90.2 | 93.4 | 94.2 | 91.2 |
| Qwen3.5-122B-A10B, thinking | 90.9 | 86.9 | 92.1 | 93.8 | 89.3 |
| gpt-oss-120b, reasoning high | 88.4 | 81.7 | 89.1 | 94.0 | 86.1 |
| Judges without reasoning | |||||
| Gemma 4 31B, thinking off | 90.7 | 84.2 | 91.7 | 94.5 | 90.2 |
| Qwen3.8-27B, thinking off | 88.7 | 86.3 | 92.1 | 90.5 | 85.0 |
| Qwen3.5-122B-A10B, thinking off | 89.9 | 86.9 | 88.7 | 93.8 | 88.7 |
| gpt-oss-120b, reasoning low | 85.3 | 76.8 | 87.4 | 89.4 | 85.0 |
| Jev 1.14 | 91.2 | 84.4 | 92.6 | 95.1 | 90.4 |
Other results.
- RewardBench 2 subsets (Gemma / Qwen): Factuality 86.1 / 83.6, Precise IF 52.5 / 55.0, Math 84.7 / 79.2, Safety 87.1 / 89.6, Focus 88.1 / 84.4, Ties 88.8 / 83.6.
- M-RewardBench per language (Gemma): cs 89.1, de 90.7, el 89.2, es 91.0, fr 91.0, it 91.4, nl 90.8, pl 90.6, pt 90.9, ro 90.9, uk 89.6.
Usage
import json
import torch
from huggingface_hub import snapshot_download
from safetensors import safe_open
from transformers import AutoConfig, AutoModel, AutoTokenizer
BRANCH = "gemma-4-31b" # or "qwen3.8-27b"
END_OF_TURN = {"gemma-4-31b": "<turn|>", "qwen3.8-27b": "<|im_end|>"}[BRANCH]
MAX_LEN = 16384 # the training length
path = snapshot_download("openeurollm/prelude-reward-models", revision=BRANCH)
tokenizer = AutoTokenizer.from_pretrained(path)
# The checkpoint holds the text model, under model.language_model.*, and the reward head, score.weight and
# score.bias. transformers reports the head as unused weights; it is read separately below.
backbone = AutoModel.from_pretrained(
path,
config=AutoConfig.from_pretrained(path).text_config,
key_mapping={r"^model\.language_model\.": ""},
dtype=torch.bfloat16,
device_map="auto",
).eval()
weight_map = json.load(open(f"{path}/model.safetensors.index.json"))["weight_map"]
with safe_open(f"{path}/{weight_map['score.weight']}", "pt") as f:
head_weight, head_bias = f.get_tensor("score.weight"), f.get_tensor("score.bias") # float32
def input_ids(messages, answer):
"""The reward model's input, built as in training: the conversation as the generation prompt with thinking
disabled, then the final answer as plain text (no reasoning), then the end-of-turn token."""
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True,
enable_thinking=False)
p = tokenizer(prompt, add_special_tokens=False)["input_ids"]
a = tokenizer(answer, add_special_tokens=False, split_special_tokens=True)["input_ids"]
end = tokenizer(END_OF_TURN, add_special_tokens=False)["input_ids"]
budget = MAX_LEN - len(end)
if len(p) + len(a) > budget: # as in training: the prompt's first 16 and last tokens, then the answer's start
cap = max(budget // 2, budget - len(a))
if len(p) > cap:
p = p[:16] + p[len(p) - (cap - 16):]
a = a[:budget - len(p)]
return p + a + end
@torch.no_grad()
def reward(messages, answer):
ids = torch.tensor([input_ids(messages, answer)], device=backbone.device)
h = backbone(input_ids=ids).last_hidden_state[0, -1].float()
return (h @ head_weight.to(h.device).T + head_bias.to(h.device)).item()
messages = [{"role": "user", "content": "Mikä on Suomen pääkaupunki? Vastaa yhdellä lauseella."}]
answers = ["Suomen pääkaupunki on Helsinki.", "Suomen pääkaupunki on Turku."]
r = [reward(messages, a) for a in answers]
print(r) # gemma-4-31b: about [2.17, -0.72]; qwen3.8-27b: about [2.34, -0.84]
print("P(first answer is better) =", torch.sigmoid(torch.tensor(r[0] - r[1])).item()) # about 0.95 / 0.96
Training
- Data: the 126,918 training pairs of openeurollm/prelude-reward-modeling. The 1,008 validation pairs above are the rest of its 127,926 pairs.
- Prompts and answers: 38 European languages, with two answers per prompt from a pool of 17 models, from Prelude checkpoints to weak old 7B models.
- Labels: the label is the share of six votes, from three open LLM judges in both presentation orders. The judges are Gemma 4 31B, Qwen3.8-27B and gpt-oss-120b, with a substitute where a judge would grade its own model family. A rule sets the label for answers that leak think tags or loop to the token limit.
- Judging criteria, in order of priority: harm, usability, language, correctness, instruction following, helpfulness and concision.
- Objective: a Bradley–Terry cross-entropy against the vote share (soft labels), with a reward-centering term of weight 0.01.
- Model: full fine-tuning of the base model's text decoder plus a linear head on the last hidden state of the answer's end-of-turn token.
- Schedule: one epoch, 991 steps of 128 pairs; AdamW (0.9, 0.95), learning rate 2e-6 with 3% warmup and cosine decay to 10%; gradient clipping at 1.0; sequences up to 16,384 tokens.
- Hardware: 4 nodes (32 AMD MI250X GCDs) of LUMI.
Model tree for openeurollm/prelude-reward-models
Base model
Qwen/Qwen3.8-27B