ART Backend
Learn the underlying architecture of the ART backend
ART divides the logic for training an agent into two distinct abstractions. The client is responsible for interfacing with the environment in which the agent runs and for sending inference and training requests to the backend. The backend is responsible for generating tokens at inference time, updating the agent’s weights based on past performance, and managing GPU memory as it switches from inference to training mode. This separation of concerns simplifies the process of teaching an agent to improve its performance using RL.
While the backend’s training and inference settings are highly configurable, they’re also set up to use intelligent defaults that save beginners time while getting started. However, there are a few important considerations to take before running your first training job.
Remote or local training
ART provides two backend classes, LocalBackend
and SkyPilotBackend
. If your agent is already running on a machine equipped with an advanced GPU and you want to run training on the same machine, use LocalBackend
. If your agent is running on a machine without an advanced GPU (this includes most personal computers and production servers), use SkyPilotBackend
instead.
Both LocalBackend
and SkyPilotBackend
implement the art.Backend
class, and once initialized, the client interacts with them in the exact same way. Under the hood, SkyPilotBackend
configures a remote machine equipped with a GPU to run LocalBackend
, and forwards requests from the client to the remote instance.
LocalBackend
The LocalBackend
class runs a vLLM server and either an Unsloth or torchtune instance on whatever machine your agent itself is executing. This is a good fit if you’re already running your agent on a machine with a GPU.
To declare a LocalBackend
instance, follow the code sample below:
SkyPilotBackend
When a SkyPilotBackend
instance is initialized, it does a few things:
- Provisions a remote machine with an advanced GPU (by default on RunPod)
- Installs
openpipe-art
and its dependencies - Initializes a
LocalBackend
instance with vLLM and a training server (unsloth or torchtune) - Registers the
LocalBackend
instance to forward requests to it over http
To initialize a SkyPilotBackend
instance, follow the code sample below:
When a training job is finished, you can shut down a cluster either through code or the cli.
Code:
CLI:
Using a backend
Once initialized, a backend can be used in the same way regardless of whether it runs locally or remotely.
To see LocalBackend
and SkyPilotBackend
in action, try the examples below.