How openpipe/art works
Project Type and Purpose
• ART is an open-source Python library that implements a client–server RL training system.
• Purpose: enable any codebase to execute “agentic” workflows (inference rollouts) via an ART client, while offloading model inference and GRPO‐based training to a dedicated ART server.
File Structure
• src/art/: the core Python package.
• art/cli.py – entry-point for CLI
• art/backend.py & art/openai.py – client interfaces to different backends
• art/local/ & art/skypilot/ – standalone server backends (vLLM local, SkyPilot for remote GPU clusters)
• art/dev/ – developer utilities (custom training loops, engines)
• art/model.py, art/trajectories.py – in‐memory representations of models & episode data
• art/utils/ – shared utilities (benchmarking, logging, S3, retry, formatters)
• examples/: illustrative use cases (2048, Codenames, Tic Tac Toe, ART•E agent)
• docs/: documentation site (MDX pages, images, analytics)
• assets/: benchmark graphs
• scripts/ & skypilot-config.yaml: ops scripts to launch clusters, kill GPU processes, publish releases
Extract Key Architecture Points from the README
• Client: OpenAI-compatible façade. Your code calls art.Client().chat().
• Server: runs separately on GPU. Exposes inference & training loops:
• Inference: loads latest LoRA into vLLM, serves completions.
• Training: groups trajectories, applies GRPO, writes new LoRA, reloads it.
• LoRA checkpoints live in server’s local filesystem (or S3 via utilities).
• Backends: local (vLLM), SkyPilot (remote cluster), plus an OpenAI‐compatible shim.
Components
a. User Code / Client
• Your application or notebook
• ART Python Client (art.cli, art.backend)
b. ART Server
• Inference Module (vLLM + LoRA loader)
• Trajectory Store (in-memory or on-disk)
• Training Module (GRPO optimizer)
• Checkpoint Store (local FS or S3)
c. Backends
• Local Backend (art.local.service)
• SkyPilot Backend (art.skypilot.stop_server, utils)
• OpenAI Shim (art.openai)
d. External Services
• GPU machines (cloud or on-prem)
• HuggingFace/vLLM model hub
• S3 (optional, via art.utils.s3)
• OpenAI API (for shim)
Relationships & Data Flow
• Inference Phase
1. User Code → ART Client → ART Server (Inference Module) → vLLM → ART Server returns LLM responses → User Code
2. ART Server logs each message in a Trajectory
• Rewarding & Training Phase
1. Upon rollout completion, User Code assigns rewards, sends Trajectories → ART Server
2. ART Server blocks further inference, runs GRPO (Training Module) → new LoRA checkpoint
3. LoRA Checkpoint → loaded back into Inference Module → inference unblocks
• Cross‐cutting
• Checkpoints read/write (local FS or S3)
• Metrics & charts generation (art.utils.benchmarking)
Architectural Patterns & Principles
• Separation of Concerns: clear split between client (API/CLI) and server (inference+training).
• Plugin Backends: interchangeable local vs remote (SkyPilot) vs OpenAI shim.
• Event‐driven Loop: inference → trajectory collection → training → reload → repeat.
• Modularity: utilities folder under art/utils for cross‐cutting features (retry, logging, S3).