How facebookresearch/truthrl works
TruthRL is a research codebase for training and evaluating LLMs to answer accurately while abstaining rather than hallucinating. Its principal workflow is to train with reinforcement-learning rewards that distinguish correct answers, hallucinations, and abstentions, then evaluate model responses with an LLM verifier. The tree also contains question-retrieval utilities and the broader verl and open-r1 training frameworks. Evidence is limited to the README, the source index, and the supplied excerpts; uncertain links are omitted or marked unverified.
Main entry points: fsdp_workers.py FSDP Workers · ray_trainer.py PPO Trainer · evaluate.py Evaluation Runner · rewards.py Reward Functions
Components 18
Question Data
- Question Retrieval
data_utils/retrieval.py - OOK Questions
data_utils/find_OOK_questions.py
RL Training
- Reward Functions
training/open-r1/src/open_r1/rewards.py - Code Providers
training/open-r1/src/open_r1/utils/code_providers.py
Training Runtime
- PPO Entry
training/verl/verl/trainer/main_ppo.py - PPO Trainer
training/verl/verl/trainer/ppo/ray_trainer.py - FSDP Workers
training/verl/verl/workers/fsdp_workers.py - FSDP Engine
training/verl/verl/workers/engine/fsdp/engine_impl.py - Batch Protocol
training/verl/verl/protocol.py - Distributed Dispatch
training/verl/verl/single_controller/base/decorator.py - FSDP Checkpoints
training/verl/verl/utils/checkpoint/fsdp_checkpoint_manager.py - Device Selection
training/verl/verl/utils/device.py
Evaluation
- Evaluation Runner
evaluation/evaluate.py - Model Inference
evaluation/model.py - Evaluation Prompts
evaluation/prompts.py
Other components
- Researcher
- LLM Verifier
- Trained Model
Connections 18
- Researcher → Question Retrieval: finds questions
- Researcher → PPO Entry: starts training
- PPO Entry → PPO Trainer: runs trainer
- PPO Trainer → FSDP Workers: dispatches work
- FSDP Workers → FSDP Engine: uses engine
- FSDP Workers → FSDP Checkpoints: saves state
training/verl/verl/workers/fsdp_workers.py - FSDP Workers → Device Selection: selects device
training/verl/verl/workers/fsdp_workers.py - FSDP Engine → Device Selection: selects device
training/verl/verl/workers/engine/fsdp/engine_impl.py - FSDP Workers → Batch Protocol: processes batches
- Distributed Dispatch → Batch Protocol: distributes batches
training/verl/verl/single_controller/base/decorator.py - Reward Functions → Code Providers: uses providers
training/open-r1/src/open_r1/rewards.py - PPO Trainer → Reward Functions: computes rewards
- PPO Trainer → LLM Verifier: requests judgments
- Researcher → Evaluation Runner: starts evaluation
- Evaluation Runner → Model Inference: runs inference
evaluation/evaluate.py - Evaluation Runner → Evaluation Prompts: uses prompts
evaluation/evaluate.py - Model Inference → LLM Verifier: requests judgments
- Evaluation Runner → Trained Model: evaluates model