dualverse-ai/pocketrl
Low-VRAM RLVR training with activation-projected gradients and shared BF16 weights
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
PocketRL is a Python/PyTorch trainer for reinforcement learning with verifiable rewards (RLVR), not an inference server. Each update samples multiple completions per prompt, grades them, and applies a Dr. GRPO policy update. The CLI enters through pocketrl.cli:main; YAML recipes and flags configure the run, while TrainConfig and PocketRLTrainer expose the same workflow to Python callers. The stack includes PyTorch, Transformers, Hugging Face Hub, safetensors, and PyYAML.
ActGRA fits a low-rank basis to each layer's input activations with QR factorization, applies row-wise Adam to the projected gradients, and maps updates back to the full weight matrix. Generation and training use the same BF16 weights. A packed 4-bit rounding remainder in the 7B and 27B recipes, or 8-bit at 1.5B, accumulates updates that would otherwise be lost to rounding, removing the need for a separate FP32 master copy.
Key Capabilities & Differentiators
The built-in recipes target Qwen2.5-Math-1.5B, Qwen2.5-Math-7B, and Qwen3.8-27B. The trainer also accepts compatible Qwen2, Qwen2.5, and Qwen3.5-style hybrid text models via a Hugging Face ID or local path. The paper recipes sample eight answers per prompt across 16 prompts per update, with up to 3,000 generated tokens per answer. The loop can be reused for other verifiable tasks with a custom dataset and Python reward function.
For 7B, persistent training state drops from 113 GiB to 18 GiB; the measured peak was 22.5 GiB on one RTX 5090. The 500-update experiment took 7.3 hours at an estimated $4.71 and reached 43.0% average accuracy across six math sets at Avg@8, up from 13.4% for the base model. The 27B experiment ran 100 updates in 9.1 hours on four RTX 5090s, peaking at 31.1 GiB per card. These figures describe the experimental runs, not the separately tabulated checkpoint evaluations.
Trade-offs & Limitations
ActGRA reduces optimizer storage by updating in an activation-derived subspace rather than retaining dense Adam state. In the 7B ablation, ActGRA and LoGRA both ran on one RTX 5090: ActGRA took 7.3 hours and peaked at 22.5 GiB, versus 12.3 hours and 31.3 GiB for LoGRA. The Dense run used two H100s, so its wall time is not a same-hardware comparison. Treat the selected rank and remainder precision as validated settings for these recipes, not universal defaults for unrelated models or reward functions.
Against TRL, the 7B comparison reports 1.8 versus 4.6 hours per 100 steps on H100 hardware. Rollout dimensions were matched, but frameworks used their own released settings and minimum viable GPU counts. PocketRL's contiguous layer placement avoids Ray and multi-node setup for the demonstrated runs, but does not establish multi-node scaling. Dollar estimates depend on GPU pricing, and peak VRAM must be rechecked when changing context length, sample count, or runtime.
Hardware & Deployment Guide
Run locally on Linux with Python 3.10 or later and PyTorch 2.6 or later; RTX 5090 systems need a PyTorch build targeting CUDA 12.8 or newer. Install .[math,vllm] for math grading and vLLM evaluation, adding hybrid for the 27B model's flash-linear-attention and causal-conv1d dependencies. Start with pocketrl train paper-1.5b --gpus 1; train and eval are separate CLI commands. The first standard run fetches models and datasets; local model and dataset paths are supported.
The first public release, v0.1.0, packages a native shared-weight decoder for training. The paper used colocated vLLM generation with shared weight views at 1.5B and 7B and pipelined generation at 27B, so packaged throughput and peak VRAM can differ. The recipes save every 50 updates, accept --resume to continue from the latest checkpoint, and write progress to metrics.jsonl. Run a short trial on the intended GPU layout before budgeting a full run.
--gpus N partitions consecutive decoder layers across visible GPUs within one process, without Ray.Teams running verifiable-reward experiments on supported Qwen models with limited single-host VRAM, or comparing Dense, LoGRA, and ActGRA under a shared training loop.
You need a production inference server, validated multi-node scaling, broad model-family compatibility, or exact reproduction of paper timing from the packaged runtime.
Quick Start & Installation
git clone https://github.com/dualverse-ai/pocketrl.git cd pocketrl pip install -e '.[math,vllm]' # math grader and vLLM evaluation pip install -e '.[math,vllm,hybrid]' # also needed for the 27B model
Comparison vs. Top LLMs & Inference Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| pocketrl ★ | 115 | +7 | Python | Apache-2.0 | Low-VRAM RLVR training with activation-projected gradients and shared BF16 weigh |
| peft | 21.9k | +32 | Python | Apache-2.0 | Python/PyTorch adapters for fine-tuning large models without updating base weigh |
| LlamaFactory | 76.4k | +86 | Python | Apache-2.0 | A unified Python framework for LLM and VLM fine-tuning with pluggable inference |
| axolotl | 12.8k | +15 | Python | Apache-2.0 | YAML-driven GPU trainer for LLM and multimodal post-training |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/dualverse-ai/pocketrl.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about pocketrl
How do I integrate a custom task and reward function?
prompt field on each row to --data and a Python callable such as rewards.py:boxed_match to --reward. Extra dataset fields arrive as keyword arguments, and the callable returns one score per sampled completion. For programmatic integration, use TrainConfig.from_recipe and PocketRLTrainer with your dataset and reward function.Is the 18 GiB figure enough to size a GPU for 7B training?
Can we self-host PocketRL for commercial work?
NOTICE, THIRD_PARTY.md, and docs/Dr-GRPO-LICENSE.txt. Check the terms for model weights, datasets, and optional dependencies separately; the PocketRL license does not grant rights to those artifacts.When should we choose PocketRL over TRL?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy