How willccbb/verifiers works
Project type and purpose
• This is an open-source Python library/toolkit (“verifiers”) for training and evaluating large language models with reinforcement learning in verifiable environments.
• It provides abstractions for Environments, Parsers, Rubrics, Trainers (GRPOTrainer), and Inference clients (vLLM/OpenAI API) to build custom multi-turn RL tasks.
High-level architecture layers
A. User layer
• Training or evaluation scripts (e.g. examples/, train.py)
• CLI entry points (vf-vllm server, accelerate launch)
B. Core library (verifiers package)
1. Environments (verifiers/envs)
– Abstract classes: Environment, MultiTurnEnv, SingleTurnEnv, ToolEnv, etc.
– Concrete envs: CodeMathEnv, SmolaToolEnv, ReasoningGymEnv, etc.
2. Parsers (verifiers/parsers)
– Standardize prompt formats and extract fields (XMLParser, ThinkParser, etc.)
3. Rubrics (verifiers/rubrics)
– Define reward functions and grouping logic
4. Tools (verifiers/tools)
– Python helper functions for tool-augmented rollouts (calculator, search, ask)
5. Inference (verifiers/inference)
– vLLM client & server code for async model serving
6. Trainers (verifiers/trainers)
– GRPOTrainer on top of transformers.Trainer + accelerate
7. Utilities & types
– Data utilities, logging, model utils, shared type definitions
C. External dependencies
• Transformers + accelerate
• vLLM server (custom microservice)
• OpenAI-compatible API endpoints
• Hugging Face datasets & model hub
• Optional: reasoning-gym, smolagents
Components and interactions
• User script invokes vf-vllm to launch inference server and then uses accelerate to start GRPO training.
• GRPOTrainer orchestrates the main loop:
1. Sample prompts from a Dataset
2. Call Environment.rollout(), which:
a. Sends messages to the Inference client (vLLM server or OpenAI API)
b. Receives responses, parses them via Parser
c. Invokes Tools as needed for tool-use environments
d. Applies Rubric(s) to compute rewards
3. Collects rollouts (prompt, completions, rewards)
4. Feeds data to transformers.Trainer for gradient updates (off-policy, async overlap)
• GRPOTrainer handles state syncing of reference models, gradient accumulation, and periodic exp to WandB/HF.
Key architectural patterns and design principles
• Modular abstractions (Environment, Parser, Rubric) promote reuse and custom extensions
• Separation of concerns: rollouts decoupled from training logic
• Async overlap of inference ←→ training
• Plugin-style integration with external model servers and APIs
• Configurable via YAML (configs/zero3.yaml) and modular entrypoints
Detailed component list
• User Scripts & CLI (examples/, train.py, vf-vllm CLI)
• verifiers.envs (Environment abstractions + concrete envs)
• verifiers.parsers (Parser classes)
• verifiers.rubrics (Rubric classes)
• verifiers.tools (Tool functions)
• verifiers.inference (vllm_client, vllm_server)
• verifiers.trainers (GRPOTrainer, async loaders)
• transformers.Trainer + accelerate backend
• External: vLLM Server, OpenAI API, HF datasets, WandB/HF Hub