How leaplabthu/absolute-zero-reasoner works
Project Type and Purpose
• This is an open-source reinforcement-learning research codebase for "Absolute Zero Reasoner", implementing a self-play pipeline that generates and solves reasoning tasks without external data.
• Core features include: data construction, reward computation, PPO-based training (via veRL), rollout engines (vLLM, Ray), and utilities for model conversion and logging.
File-Structure Analysis
• Top-level folders:
• absolute_zero_reasoner: main application modules (configs, data_construction, rewards, trainer, utils).
• data: seed datasets for self-play.
• scripts: shell wrappers for data seeding and self-play.
• verl: embedded veRL framework (trainer core, models, utilities, workers).
• tests: unit and end-to-end tests.
• Configuration files (YAML) live in configs under both absolute_zero_reasoner and verl/trainer/config.
• Entrypoints:
• main_azr_ppo.py in absolute_zero_reasoner
• scripts/selfplay/*.sh and scripts/seeding/*.sh
• conversion utility in utils/convert2hf.py
• External integrations: vLLM for rollout, Ray for distributed training, Weights & Biases for logging, Hugging Face for model conversion.
Architecture Overview
a. Main Components
1. Seed Data Loader
2. Task Constructor (absolute_zero_reasoner/data_construction)
3. Rollout Engine
– vLLM rollout (verl/third_party/vllm or utils/python_executor)
– Ray-based actor–critic rollout (verl/workers)
4. Reward Manager (absolute_zero_reasoner/rewards + verl/workers/reward_manager)
5. PPO Trainer (absolute_zero_reasoner/trainer/ppo + verl/trainer)
6. Model Store & Conversion (absolute_zero_reasoner/utils/convert2hf)
7. Logging & Tracking (absolute_zero_reasoner/utils/logging_utils + W&B)
8. Config Manager (YAML files feeding into each component)
b. Relationships & Data Flow
1. Seed data → Task Constructor → Generated tasks
2. Generated tasks → Rollout Engine → Model outputs (proposals/solutions)
3. Model outputs → Python Executor (validation/parsing) → Reward Manager
4. Reward signals → PPO Trainer → Model parameter updates
5. Trainer checkpoints → Model Store → Conversion to Hugging Face format
6. Throughout: metrics → Logging & W&B
c. Architectural Patterns & Principles
• Modular pipeline: clearly separated data construction, rollout, reward, and training stages.
• Plugin-style reward and rollout: custom reward functions and multiple rollout backends (naive, vLLM, Ray).
• Distributed training via Ray and low-level veRL abstractions (actors, workers, sharding).
• Configuration-driven: behaviors controlled by YAML under configs directories.
d. Key Technologies & Frameworks
• Python 3.10, PyTorch
• veRL (verl/) for training loop and distributed workers
• vLLM for fast batched language model rollouts
• Ray for distributed task scheduling
• Weights & Biases for experiment tracking
• Hugging Face Transformers for model format conversions
• YAML for configuration
Essential Elements
• Clear component labels (e.g., “Task Constructor”, “Reward Manager”)
• Data stores (seed datasets, checkpoints)
• Callouts for external services (W&B, Hugging Face, Ray, vLLM)