Downloads · 30 days
10
24% of all-time downloads
xander2432/djpo-reward-model
djpo-reward-model is a text classification model from xander2432. Use it when you need a label for a piece of text. The card lists the license as mit.
This is the reward model from the DJ-PO (Diverse Job Prompt Optimizer) framework, designed to score text-to-image prompts based on their likelihood of generating stereotypical occupation representations.
Downloads · 30 days
10
24% of all-time downloads
All-time downloads
42
Public
Repo size
438 MB
Likes
0
Public
Click a slice to open those files.
.pth438 MB · 100%
From the Hugging Face model README
This is the reward model from the DJ-PO (Diverse Job Prompt Optimizer) framework, designed to score text-to-image prompts based on their likelihood of generating stereotypical occupation representations.
DJ-PO Reward Model is a lightweight PyTorch model that predicts stereotypicality scores for text prompts. It combines a frozen SentenceTransformer encoder with a trainable linear head to efficiently learn ranking relationships from human feedback.
sentence-transformers/all-mpnet-base-v2 (frozen)This model is designed to score occupation-related text prompts before feeding them to text-to-image models. Prompts scoring below a threshold (default: 0.12) are flagged for optimization using an LLM to reduce stereotypical outputs.
import torch
from sentence_transformers import SentenceTransformer
import torch.nn as nn
# Define the model architecture
class RewardModel(nn.Module):
def __init__(self, sentence_transformer_model_name='sentence-transformers/all-mpnet-base-v2', embedding_dim=768):
super(RewardModel, self).__init__()
self.embedding_model = SentenceTransformer(sentence_transformer_model_name)
self.fc = nn.Linear(embedding_dim, 1)
self.dropout = nn.Dropout(p=0.1)
def forward(self, prompts):
embeddings = self.embedding_model.encode(prompts, convert_to_tensor=True)
scores = self.fc(self.dropout(embeddings)).squeeze(-1)
return scores
# Load the model
model = RewardModel()
model.load_state_dict(torch.load('reward_model_listwise_3.0_main.pth', map_location=torch.device('cpu')))
model.eval()
# Score a prompt
prompt = "Generate an image of a CEO"
with torch.no_grad():
score = model([prompt]).item()
print(f"Stereotypicality Score: {score:.4f}")
print(f"Needs Optimization: {score < 0.12}")
Threshold: Prompts scoring below 0.12 are considered stereotypical and should be optimized.
The DJ-PO framework (using this reward model) was validated through human evaluation:
The model was trained to recognize prompts that consider these diversity dimensions:
If you use this model in your research, please cite:
@inproceedings{zwakenberg2025djpo,
title={Reducing Occupation Stereotypes in T2I models using Reward Models and Prompt Optimization},
author={Zwakenberg, Alex and Tacoma, Sietske and Mioch, Tina and Peeters, Marieke M. M.},
booktitle={Proceedings of [Conference Name]},
year={2025},
organization={University of Applied Sciences Utrecht}
}
Alex Zwakenberg (University of Applied Sciences Utrecht)
This model is released under the MIT License. See the LICENSE file for details.
This research was supported by:
Disclaimer: This model is a research prototype. While it demonstrates significant bias reduction in controlled evaluations, it does not eliminate all stereotypical outputs and should be used as part of a comprehensive ethical AI strategy.