Plate V

Strawberry Cake

Designing a machine learning pipeline to accelerate research

Overview

If you read our blogs (please do, they are written by a human), you should know that we are working towards annotating Cockatoo Moderation V1. While the annotation pipeline is running, we haven't been slacking. We took this time to rethink our old machine learning repository Cockatoo_ML_Training and optimized it for faster iteration and deployment. The blog today will go through some details of what we did.

The redesign involves two parts: Cockatoo Machine Learning Orchestrator (CMLO), and Cockatoo Machine Learning Worker (CMLW).

Training

CMLO

CMLO is the orchestration server, think of it as Pterodactyl Panel, AWX, or Rancher, which doesn't do anything on its own; instead, it's designed to be the management panel with RBAC, OIDC, and OAuth support used to deploy training runs on registered CMLW (workers) instances. CMLO also serves as a centralized artifact storage for CMLW. When a training run starts, CMLO will host the necessary files (such as weights, datasets, etc.) for CMLW to download from, acting like a cache so CMLW doesn't have to provision data from a remote (far) server like HuggingFace to speed up downloads.

Worker Monitoring

The best part? CMLO was engineered with Cockatoo Data Studio (CDS) support in mind. CMLO can directly download annotated data from CDS which makes this a really streamlined process.

CDS support and Artifact Store

After a run starts, CMLO will continuously receive telemetry data from CMLW such as different GPU metrics, loss, gradient norm, LR, and epoch. Evaluation data will also be collected by CMLO based on how often evaluation runs during training.

CMLO Training
CMLO Eval

When a training run finishes, CMLO will accept weights/artifact uploads from CMLW to receive the weights back so everything goes back to one place for storage. After that, an inference workload can also be started in the CMLO UI, which I'll talk about in a bit.

CMLW

CMLW is the software for a GPU server. It's a modified version of the original ML_Training repository that contains mostly identical code in the main parts, but now with added integration for an API server (to integrate with CMLO, obviously) and multi-node DDP via GLOO/NCCL backends. When starting a multi-node DDP job, CMLO will provision the fleet IPs to all CMLW instances involved so rendezvous is managed and doesn't rely on janky discovery logic.

During registration, CMLO will provision a short-lived token for CMLW to enroll, and then CMLW can properly authenticate with the CMLO server.

Inference

CMLO

Within the UI, a user with the appopriate permissions can start an inference job on any of the free CMLW nodes. When a job starts, CMLO will instruct the worker to pull the weights from CMLO, and then CMLO will provision an API token for the user so inference can be accessed from an authenticated endpoint from the user directly accessing the CMLW inference API with the token. CMLO can also directly call out to CMLW's inference endpoint to test the model quickly.

CMLO Inference Deploy
CMLO Run Inf

CMLW

The inference code in CMLW hasn't changed much for the rewrite, same logic, just with some handshake agreements with CMLO and stuff.

Strawberry Cake

So all this talk about ML jargon doesn't relate to the title, why? Well, this is the new system architecture behind Strawberry Cake, a preliminary evaluation model that we used to evaluate both the semi-annotated Cockatoo Moderation V1 dataset and the new software stack. Despite the model performing as expected (that is to say, crappy), we are quite happy that the improvements in tooling have indeed worked out for us. We hope that in the future, the more streamlined and integrated pipeline will enable us to iterate faster and produce far better results.

Warning

Strawberry Cake is NOT production ready and should NEVER be used in production. This is a POC only.


Happy November!

The Cockatoo Team