How leeyejin1231/rv-hate works
RV-HATE detects implicit hate speech through contrastive representation learning and an adaptive multi-module voting design. Its data workflow clusters and preprocesses dataset examples, builds tokenized training batches, trains base or hard-negative models, then evaluates module predictions. The README also describes target tagging and cluster-based outlier removal as specialized capabilities. The source index supports the main training, loading, model, and evaluation links; connections among voting and reinforcement-learning internals are limited to README-level evidence because those implementations were not excerpted.
Main entry points: model.py Text encoder · train.py Contrastive trainer · train_hard_negative.py Hard-negative trainer · shared_semantics.py Semantic preparation
Components 20
Data preparation
- Semantic preparation
utils/shared_semantics.py - Context clustering
utils/clustering.py - Dataset preprocessing
utils/preprocess_dataset.py - Dataset loader
utils/dataset_loader.py - Batch collation
utils/collate_fns_sharedcon.py
Model training
- Training settings
config/train_config.py - Hard-negative settings
config/train_hard_negative_config.py - Contrastive trainer
train.py - Hard-negative trainer
train_hard_negative.py
Detection modules
- Text encoder
model/model.py - Contrastive losses
model/loss_sharedcon.py - Target tagging
utils/shared_semantics.py - Outlier removal
utils/shared_semantics.py - Hard-negative sampling
train_hard_negative.py
Evaluation
- Evaluation settings
config/eval_config.py - Model evaluation
eval.py - Voting evaluation
eval_hard_voting.py - Soft voting
eval_soft_voting.py - Reinforcement evaluation
ppo_eval.py
Other components
- Researcher
Connections 30
- Researcher → Semantic preparation: prepares data
README.md - Semantic preparation → Context clustering: uses clustering
utils/shared_semantics.py - Researcher → Dataset preprocessing: tokenizes data
README.md - Dataset preprocessing → Dataset loader: supplies datasets
README.md - Dataset loader → Batch collation: selects collator
utils/dataset_loader.py - Researcher → Contrastive trainer: starts training
README.md - Contrastive trainer → Training settings: loads settings
train.py - Contrastive trainer → Dataset loader: loads batches
train.py - Contrastive trainer → Text encoder: encodes text
train.py - Contrastive trainer → Contrastive losses: computes loss
train.py - Researcher → Hard-negative trainer: trains module
README.md - Hard-negative trainer → Hard-negative settings: loads settings
train_hard_negative.py - Hard-negative trainer → Dataset loader: loads batches
train_hard_negative.py - Hard-negative trainer → Text encoder: encodes text
train_hard_negative.py - Hard-negative trainer → Hard-negative sampling: maintains queue
train_hard_negative.py - Researcher → Model evaluation: evaluates models
README.md - Model evaluation → Evaluation settings: loads settings
eval.py - Model evaluation → Text encoder: uses model
eval.py - Researcher → Voting evaluation: runs voting
README.md - Voting evaluation → Evaluation settings: loads settings
eval_hard_voting.py - Voting evaluation → Text encoder: uses model
eval_hard_voting.py - Researcher → Soft voting: runs voting
README.md - Soft voting → Evaluation settings: loads settings
eval_soft_voting.py - Soft voting → Text encoder: uses model
eval_soft_voting.py - Researcher → Reinforcement evaluation: runs evaluation
README.md - Reinforcement evaluation → Evaluation settings: loads settings
ppo_eval.py - Reinforcement evaluation → Text encoder: uses model
ppo_eval.py - Semantic preparation → Target tagging: tags targets
utils/shared_semantics.py - Semantic preparation → Outlier removal: removes outliers
utils/shared_semantics.py - Reinforcement evaluation → Voting evaluation: optimizes voting
README.md