Data is continuously generated on the edge side. Traditionally, the data is collected manually and periodically retrained on the cloud to improve the model effect. This method wastes a lot of human resources, and the model update frequency is slow. Incremental learning allows users to continuously monitor the newly generated data and by configuring some triggering rules to determine whether to start training, evaluation, and deployment automatically, and continuously improve the model performance.
- Automatically retrains, evaluates, and updates models based on the data generated at the edge.
- Support time trigger, sample size trigger, and precision-based trigger.
- Support manual triggering of training, evaluation, and model update.
- support hard sample discovering of unlabeled data, for reducing the manual labeling workload.
- Support lifelong learning that reserves historical knowledge to avoid frequent re-training/ re-fine-tuning, and tackles samples uncovered in historical knowledge base.
We propose using Kubernetes Custom Resource Definitions (CRDs) to describe the incremental learning specification/status and a controller to synchronize these updates between edge and cloud.
- Users can create the incremental learning jobs, by providing training scripts, configuring training hyperparameters, providing training datasets, configuring training and deployment triggers.
There are three stages in a incremental learning job: train/eval/deploy.
Each stage contains these below states:
- Waiting: wait to trigger satisfied, i.e. wait to train/eval/deploy
- Ready: the corresponding trigger satisfied, now ready to train/eval/deploy
- Starting: the corresponding stage is starting
- Running: the corresponding stage is running
- Failed: the corresponding stage failed
- Completed: the corresponding stage completed
The IncrementalLearningJob
CRD will be namespace-scoped.
The tables below summarize the group, kind and API version details for the CRD.
- IncrementalLearningJob
Field | Description |
---|---|
Group | sedna.io |
APIVersion | v1alpha1 |
Kind | IncrementalLearningJob |
See the crd source for details.
See the golang source for details.
Open API v3 Schema based validation can be used to guard against bad requests. Invalid values for fields (example string value for a boolean field etc) can be validated using this.
Here is a list of validations we need to support :
- The
dataset
specified in the crd should exist in k8s. - The
model
specified in the crd should exist in k8s. - The edgenode name specified in the crd should exist in k8s.
See the source for an example.
The incremental learning controller starts three separate goroutines called upstream
, downstream
and incrementallearningjob
controller.
These are not separate controllers as such but named here for clarity.
- incremental learning: watch the updates of incremental-learning job crds, and create the workers depending on the state machine.
- downstream: synchronize the incremental-learning-job updates from the cloud to the edge node.
- upstream: synchronize the incremental-learning-job updates from the edge to the cloud node.
The incremental-learning controller watches for the updates of incremental-learning jobs and the corresponding pods against the K8S API server.
Updates are categorized below along with the possible actions:
Update Type | Action |
---|---|
New Incremental-learning-job Created | Wait to train trigger satisfied |
Incremental-learning-job Deleted | NA. These workers will be deleted by k8s gc. |
The Status of Incremental-learning-job Updated | Create the train/eval worker if it's ready. |
The corresponding pod created/running/completed/failed | Update the status of incremental-learning job. |
The downstream controller watches for the incremental-learning job updates against the K8S API server.
Updates are categorized below along with the possible actions that the downstream controller can take:
Update Type | Action |
---|---|
New Incremental-learning-job Created | Sends the job information to LCs. |
Incremental-learning-job Deleted | The controller sends the delete event to LCs. |
The upstream controller watches for the incremental-learning job updates from the edge node and applies these updates against the API server in the cloud.
Updates are categorized below along with the possible actions that the upstream controller can take:
Update Type | Action |
---|---|
Incremental-learning-job Reported State Updated | The controller appends the reported status of the job by LC in the cloud. |
-
GM(downstream controller) syncs the job info to LC:
// POST <namespace>/incrementallearningjobs/<job-name> // body same to the job crd of k8s api, omitted here.
-
LC uploads the job status which reported by the worker to GM(upstream controller):
// POST <namespace>/incrementallearningjobs/<job-name>/status // WorkerMessage defines the message from that the training worker. It will send to GM. type WorkerMessage struct { Phase string `json:"phase"` Status string `json:"status"` Output *WorkerOutput `json:"output"` } // type WorkerOutput struct { Models []*Model `json:"models"` OwnerInfo *OwnerInfo `json:"ownerInfo"` } // Model defines the model information type Model struct { Format string `json:"format"` URL string `json:"url"` // Including the metrics, e.g. precision/recall Metrics map[string]float64 `json:"metrics"` } // TaskInfo defines the task information type TaskInfo struct { // Current training round CurrentRound int `json:"currentRound"` UpdateTime string `json:"updateTime"` }
- Flow of the job creation:
- Flow of the
train
stage:
- Flow of the
eval
stage:
- Flow of the
deploy
stage:
No need to communicate between workers.