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.
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.
There are three stages in a incremental learning job: train/eval/deploy.
Each stage contains these below states:
The IncrementalLearningJob CRD will be namespace-scoped.
The tables below summarize the group, kind and API version details for the CRD.
| 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 :
dataset specified in the crd should exist in k8s.model 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 incrementallearningjobcontroller.
These are not separate controllers as such but named here for clarity.
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"`
}
train stage:eval stage:deploy stage:No need to communicate between workers.