Downloads · 30 days
21
40% of all-time downloads
Misha0706/llm-alignment-reward-model
llm-alignment-reward-model is a text classification model from Misha0706. Use it when you need a label for a piece of text. It is set up for transformers.
This repository contains a reward model trained for a coursework project on language model alignment. The model is based on HuggingFaceTB/SmolLM-135M-Instruct and was fine-tuned to score preferred responses higher tha…
Downloads · 30 days
21
40% of all-time downloads
All-time downloads
53
Public
Parameters
135M
269 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors269 MB · 100%
From the Hugging Face model README
This repository contains a reward model trained for a coursework project on language model alignment. The model is based on HuggingFaceTB/SmolLM-135M-Instruct and was fine-tuned to score preferred responses higher than rejected ones using human preference data.
This model is a sequence classification model with a single scalar output. It was trained on preference pairs from HumanLLMs/Human-Like-DPO-Dataset and is intended to assign higher scores to preferred assistant responses than to rejected ones.
In the project pipeline, this model was used as:
a standalone reward model for evaluation;
the reward model in PPO training;
the initialization source for the PPO value model.
Developed by: Mikhail Kalinkin
Model type: Reward model / sequence classification model
Language(s): English
Finetuned from model: HuggingFaceTB/SmolLM-135M-Instruct
HuggingFaceTB/SmolLM-135M-InstructHumanLLMs/Human-Like-DPO-DatasetThis model is intended for:
The model takes a user-assistant conversation and returns a scalar score. Higher scores indicate that the response is more preferred according to the learned reward signal.
Possible downstream uses:
This model is not intended for:
This reward model inherits limitations from:
Main limitations:
This model should be used as an experimental reward component, not as a reliable universal judge. For serious use, additional evaluation, calibration, and broader testing are necessary.
Use the code below to score a conversation:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_id = "Misha0706/llm-alignment-reward-model"
tokenizer_id = "HuggingFaceTB/SmolLM-135M-Instruct"
tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)
tokenizer.pad_token = tokenizer.eos_token
model = AutoModelForSequenceClassification.from_pretrained(
model_id,
num_labels=1,
)
model.eval()
messages = [
{"role": "user", "content": "Do you have a favorite type of vacation or getaway?"},
{"role": "assistant", "content": "I love outdoor adventures, especially hiking and kayaking."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False)
inputs = tokenizer(text, return_tensors="pt")
with torch.no_grad():
score = model(**inputs).logits[0].item()
print("Reward score:", score)
To compare two candidate responses, score them separately and choose the one with the higher value.
The model was trained on:
HumanLLMs/Human-Like-DPO-DatasetThis dataset contains triples of:
For reward model training, each example was converted into implicit preference format:
chosen = [user message, assistant chosen response]rejected = [user message, assistant rejected response]The model was trained with TRL RewardTrainer using a single scalar head on top of the base checkpoint.
Only the reward head was trained, while the rest of the model was frozen in this coursework setup.
Preprocessing steps:
RewardTrainerHuggingFaceTB/SmolLM-135M-Instruct3e-4The model was checked on held-out examples from the same preference dataset after a train/test split.
The main factor examined was pairwise preference ordering:
The reported metric in the project was simple pairwise preference success on inspected examples:
chosen_score > rejected_scoreOn the manually inspected examples shared in the project report:
3.3539, rejected -0.35801.7551, rejected -0.36512.7441, rejected -0.73522.4800, rejected -0.85252.8219, rejected 0.9179In the reported qualitative check, the reward model preferred the chosen response in 5/5 examples.
This indicates that the model learned the desired pairwise ordering signal on the inspected test examples and was suitable for use as the reward component in the PPO part of the project.
HuggingFaceTB/SmolLM-135M-InstructThis model was trained as part of a coursework environment on limited compute. Precise hardware and emissions tracking were not recorded.
Not reported.
This is a coursework reward model and should be treated as an experimental artifact.
It may:
If you use this repository, please cite the original base model and dataset:
HuggingFaceTB/SmolLM-135M-InstructHumanLLMs/Human-Like-DPO-DatasetYou may also reference this repository as a coursework reward model trained with TRL.